title: PostgreSQL "IS [NOT] DISTINCT FROM" operator
body: <p>Let's suppose a table:</p>
  
  <pre><code>CREATE TABLE foo (
    id serial primary key
    , range int4range NOT NULL
    , barid integer references bar(id)
    , baz whatever... NOT NULL
    , EXCLUDE USING gist (range WITH &amp;&amp;, barid WITH =)
  );
  </code></pre>
  
  <p>The exclusion constraint is supposed to not allow overlapping "range" values for the same "barid" value. But I would like it to treat "NULL" just like other values (so not allow overlappig ranges for diffrent records having barid = NULL). So given a = NULL and b = NULL, I would like to achieve "a IS NOT DISTINCT FROM b" type of behaviour , instead of "a = b" one (as described <a href="http://www.postgresql.org/docs/9.3/static/functions-comparison.html" rel="nofollow">here</a>). Does such an operator exist? At the moment I am able to achieve that only by using </p>
  
  <pre><code>EXCLUDE USING gist (range WITH &amp;&amp;, COALESCE(barid, -1) WITH =)
  </code></pre>