BUG #13336: Unexpected result from invalid query

Поиск
Список
Период
Сортировка
От chris@chrullrich.net
Тема BUG #13336: Unexpected result from invalid query
Дата
Msg-id 20150523000527.17709.45231@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #13336: Unexpected result from invalid query  (Christian Ullrich <chris@chrullrich.net>)
Re: BUG #13336: Unexpected result from invalid query  (Andres Freund <andres@anarazel.de>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      13336
Logged by:          Christian Ullrich
Email address:      chris@chrullrich.net
PostgreSQL version: 9.4.2
Operating system:   Windows 8.1
Description:

An invalid column name in a subquery will be silently resolved against the
main query's table:

postgres=# create table test_table (foo varchar(10), bar integer);
CREATE TABLE
postgres=# insert into test_table values ('one', 1);
INSERT 0 1
postgres=# insert into test_table values ('two', 2);
INSERT 0 1
postgres=# create table test_table2 (baz varchar(10));
CREATE TABLE
postgres=# insert into test_table2 values ('gromp');
INSERT 0 1

-- Note: No column "foo" in test_table2
postgres=# select * from test_table where foo in (select foo from
test_table2);
 foo | bar
-----+-----
 one |   1
 two |   2


I actually noticed this when querying "select * from
pg_available_extension_versions where name in (select name from
pg_extension)", which returns the whole contents of the
pg_available_extension_versions view although I got the column name in
pg_extension wrong.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #13334: PostGIS 2.2 crash in topology (array_contain_compare)
Следующее
От: Christian Ullrich
Дата:
Сообщение: Re: BUG #13336: Unexpected result from invalid query