Re: Intersection or zero-column queries - Mailing list pgsql-general

From David G. Johnston
Subject Re: Intersection or zero-column queries
Date
Msg-id CAKFQuwZ+5retWrniZh+NokvV_+Fc0mjRqZ5Xn-Ly-a4M1o6vRw@mail.gmail.com
Whole thread Raw
In response to Intersection or zero-column queries  (Victor Yegorov <vyegorov@gmail.com>)
Responses Re: Intersection or zero-column queries
List pgsql-general
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...

David J.

pgsql-general by date:

Previous
From: Victor Yegorov
Date:
Subject: Intersection or zero-column queries
Next
From: Victor Yegorov
Date:
Subject: Re: Intersection or zero-column queries