pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #16511: Using '= all ( )' with empty table returns true
2+ messages / 2 participants
[nested] [flat]

* BUG #16511: Using '= all ( )' with empty table returns true
@ 2020-06-25 17:40  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 2+ messages in thread

From: PG Bug reporting form @ 2020-06-25 17:40 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: anton.lugovoy.hopni@gmail.com

The following bug has been logged on the website:

Bug reference:      16511
Logged by:          Anton Luhavy
Email address:      anton.lugovoy.hopni@gmail.com
PostgreSQL version: 10.7
Operating system:   MacOS
Description:        

Given table is "task" (id uuid primary key, status text not null),
Query "select 'b' = all (select status from task where status = 'a')"
returns true if table "task" is empty



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #16511: Using '= all ( )' with empty table returns true
@ 2020-06-25 18:00  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2020-06-25 18:00 UTC (permalink / raw)
  To: anton.lugovoy.hopni@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> Given table is "task" (id uuid primary key, status text not null),
> Query "select 'b' = all (select status from task where status = 'a')"
> returns true if table "task" is empty

Why do you think that's wrong?  It matches usual mathematical practice,
and even if you dispute that, the SQL standard is quite explicit about it:

         1) Let R be the result of the <row value constructor> and let T be
            the result of the <table subquery>.
            ...
            a) If T is empty or if the implied <comparison predicate> is
              true for every row RT in T, then "R <comp op> <all> T" is
              true.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-06-25 18:00 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 17:40 BUG #16511: Using '= all ( )' with empty table returns true PG Bug reporting form <noreply@postgresql.org>
2020-06-25 18:00 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox