On Thu, Dec 21, 2017 at 4:53 PM, Victor Yegorov <vyegorov@gmail.com> wrote:
postgres=# select except select;
--
(2 rows)
postgres=# select intersect all select;
--
(2 rows)
Why is it so?
Should this be reported as a bug?.. ;)
The intersection case seems correct - one row from each sub-relation is returned since ALL is specified and both results as the same.
The except case looks like a bug because there should never be more rows returned from the combined query than the upper sub-query returns alone. Based upon the result of intersect it should in fact return zero rows - unless this one of those null-like scenarios where it is both equal and not equal at the same time...