On 11 November 2013 14:34, Tom Lane <t...@sss.pgh.pa.us> wrote: > "Colin 't Hart" <colinth...@gmail.com> writes: >> I can't get Postgresql to execute a query with EXCEPT (or INTERSECT) >> as an anti-join (or join). > >> Is this even possible? > > No, and it probably won't ever be, since the semantics aren't the same. > EXCEPT/INTERSECT imply duplicate elimination.
Can't we just use DISTINCT for that? Given a query <query_1> EXCEPT <query_2> isn't it always possible to rewrite this as select distinct * from (<query_1>) q1 where not exists (select 1 from (<query_2>) q2 where q1.col1 = q2.col1 and q1.col2 = c2.col2 and ... and q1.colN = q2.colN) ? Regards, Colin -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers