Re: Execute query with EXCEPT, INTERSECT as anti-join, join?
| От | Colin 't Hart |
|---|---|
| Тема | Re: Execute query with EXCEPT, INTERSECT as anti-join, join? |
| Дата | |
| Msg-id | CAMon-aQLLAKBGc_pCRRmb92HPfoepUgV6-zd0ecLg2BqA+ch8Q@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Execute query with EXCEPT, INTERSECT as anti-join, join? (Tom Lane <tgl@sss.pgh.pa.us>) |
| Ответы |
Re: Execute query with EXCEPT, INTERSECT as anti-join, join?
|
| Список | pgsql-hackers |
On 11 November 2013 14:34, Tom Lane <tgl@sss.pgh.pa.us> wrote: > "Colin 't Hart" <colinthart@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
В списке pgsql-hackers по дате отправления: