On Tue, Feb 7, 2017 at 3:58 PM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Joel Jacobson <j...@trustly.com> writes: > > Currently there is no simple way to check if two sets are equal. > > Uh ... maybe check whether SELECT set1 EXCEPT SELECT set2 > and SELECT set2 EXCEPT SELECT set1 are both empty? > > regards, tom lane > > > Yes, if the wanted result is true or false, something like this:
SELECT EXISTS (TABLE a EXCEPT TABLE b) OR EXISTS (TABLE b EXCEPT TABLE a) ; And if a new operator was added (in the same category as UNION and EXCEPT), it could be: SELECT EXISTS (TABLE a XORSET TABLE b) ; What about using the = and <> operators in sets? Is the following allowed in the standard? SELECT (TABLE a) <> (TABLE b) ;