Re: BUG #17754: Subquery IN clause returns row matches where subquery is invalid

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #17754: Subquery IN clause returns row matches where subquery is invalid
Дата
Msg-id 4191911.1674157368@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #17754: Subquery IN clause returns row matches where subquery is invalid  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> A subquery that has an incorrect column name, that happens to match a column
> name in the outer query evaluates as true for all rows in the outer query.

Such a reference is called an "outer reference", and it's a required
feature in the SQL standard.  The reason you get "true" is that the
expression

> where a in ( select a from btable where c = 10) ;

is basically reducing to "a = a".


https://wiki.postgresql.org/wiki/FAQ#Why_doesn.27t_PostgreSQL_report_a_column_not_found_error_when_using_the_wrong_name_in_a_subquery.3F

            regards, tom lane



В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17754: Subquery IN clause returns row matches where subquery is invalid
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #17753: pg_dump --if-exists bug