From: Tom Lane <tgl@sss.pgh.pa.us>
To: anton.lugovoy.hopni@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16511: Using '= all ( )' with empty table returns true
Date: Thu, 25 Jun 2020 14:00:37 -0400
Message-ID: <2286502.1593108037@sss.pgh.pa.us> (raw)
In-Reply-To: <16511-ca1a7368d7453b7b@postgresql.org>
References: <16511-ca1a7368d7453b7b@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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, anton.lugovoy.hopni@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16511: Using '= all ( )' with empty table returns true
In-Reply-To: <2286502.1593108037@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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