Re: Intersection or zero-column queries

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Victor Yegorov <vyegorov(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Intersection or zero-column queries
Date: 2017-12-22 00:03:35
Message-ID: CAKFQuwZ+5retWrniZh+NokvV_+Fc0mjRqZ5Xn-Ly-a4M1o6vRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Dec 21, 2017 at 4:53 PM, Victor Yegorov <vyegorov(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Victor Yegorov 2017-12-22 00:08:55 Re: Intersection or zero-column queries
Previous Message Victor Yegorov 2017-12-21 23:53:35 Intersection or zero-column queries