BUG #16511: Using '= all ( )' with empty table returns true

Поиск
Список
Период
Сортировка
Искать

BUG #16511: Using '= all ( )' with empty table returns true

От:
PG Bug reporting form <noreply@postgresql.org>
Дата:
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

Re: BUG #16511: Using '= all ( )' with empty table returns true

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
PG Bug reporting form  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  and let T be
            the result of the .
            ...
            a) If T is empty or if the implied  is
              true for every row RT in T, then "R   T" is
              true.

			regards, tom lane


FAQ