INTERSECT/EXCEPT and duplicates?

Started by Tatsuo Ishiiover 26 years ago3 messages
#1Tatsuo Ishii
t-ishii@sra.co.jp

Hi,

SQL92 seems to assume that results of the INTERSECT/EXCEPT contain no
duplications unless "ALL" is specified. However PostgreSQL 6.5.1 does
not follow the requirement, I think. Maybe we need to add this to the
TODO list?
---
Tatsuo Ishii

#2Bruce Momjian
maillist@candle.pha.pa.us
In reply to: Tatsuo Ishii (#1)
Re: [HACKERS] INTERSECT/EXCEPT and duplicates?

Hi,

SQL92 seems to assume that results of the INTERSECT/EXCEPT contain no
duplications unless "ALL" is specified. However PostgreSQL 6.5.1 does
not follow the requirement, I think. Maybe we need to add this to the
TODO list?
---

Added to TODO:

* have INTERSECT/EXCEPT prevent duplicates unless ALL is specified

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#2)
Re: [HACKERS] INTERSECT/EXCEPT and duplicates?

Tatsuo Ishii <t-ishii@sra.co.jp> writes:

SQL92 seems to assume that results of the INTERSECT/EXCEPT contain no
duplications unless "ALL" is specified. However PostgreSQL 6.5.1 does
not follow the requirement, I think.

I think you are right --- the ALL keyword is only implemented for UNION
(and it's not quite right there either :-(). For the other two, you
just get whichever behavior was easiest to implement, I suppose...

regards, tom lane