Re: BUG #2739: INTERSECT ALL not working

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2739: INTERSECT ALL not working
Дата
Msg-id 28525.1162839809@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #2739: INTERSECT ALL not working  ("Mason Hale" <masonhale@gmail.com>)
Ответы Re: BUG #2739: INTERSECT ALL not working
Список pgsql-bugs
"Mason Hale" <masonhale@gmail.com> writes:
> The query below should return 10 rows,

Not by my reading of the spec.  SQL92 7.10 saith:

            b) If a set operator is specified, then the result of applying
              the set operator is a table containing the following rows:

              i) Let R be a row that is a duplicate of some row in T1 or of
                 some row in T2 or both. Let m be the number of duplicates
                 of R in T1 and let n be the number of duplicates of R in
                 T2, where m >= 0 and n >= 0.

...

            iii) If ALL is specified, then

...


                 3) If INTERSECT is specified, then the number of duplicates
                   of R that T contains is the minimum of m and n.

You have m = 1, n = 2 for each distinct row at the INTERSECT step,
ergo you get one copy out.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Mason Hale"
Дата:
Сообщение: BUG #2739: INTERSECT ALL not working
Следующее
От: "Mason Hale"
Дата:
Сообщение: Re: BUG #2739: INTERSECT ALL not working