title: Postgres UNIQUE CONSTRAINT for array
body: <p>How to create a constraint on the uniqueness of all the values ​​in the array like:</p>
  
  <pre class="lang-sql prettyprint-override"><code>CREATE TABLE mytable
  (
      interface integer[2],
      CONSTRAINT link_check UNIQUE (sort(interface))
  )
  </code></pre>
  
  <p>my sort function</p>
  
  <pre class="lang-sql prettyprint-override"><code>create or replace function sort(anyarray)
  returns anyarray as $$
  select array(select $1[i] from generate_series(array_lower($1,1),
  array_upper($1,1)) g(i) order by 1)
  $$ language sql strict immutable; 
  </code></pre>
  
  <p>I need that would be the value {10, 22} and {22, 10} considered the same and check under the UNIQUE CONSTRAINT</p>