Re: BUG #9006: Incorrect update when using where with non-existent column in subselect

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #9006: Incorrect update when using where with non-existent column in subselect
Дата
Msg-id 420.1390875223@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #9006: Incorrect update when using where with non-existent column in subselect  (martin.nzioki@gmail.com)
Ответы Re: BUG #9006: Incorrect update when using where with non-existent column in subselect  ("Martin Nzioki" <martin.nzioki@gmail.com>)
Список pgsql-bugs
martin.nzioki@gmail.com writes:
> create table _test1 (id int not null primary key, c2 int);
> insert into _test1 (id) select * from generate_series(1, 5);

> create table _tmp_test2 (id_fk int not null);
> insert into _tmp_test2 (id_fk) select id from _test1 limit 2;

> update _test1 set c2 = 7 where id in (select id from _tmp_test2);

This is a FAQ ... that statement is perfectly valid per SQL standard,
it just doesn't do what you expect, because the sub-select's "id" is
taken as an outer reference to _test1's id column.

            regards, tom lane

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

Предыдущее
От: martin.nzioki@gmail.com
Дата:
Сообщение: BUG #9006: Incorrect update when using where with non-existent column in subselect
Следующее
От: stefan.kirchev@gmail.com
Дата:
Сообщение: BUG #9007: List comparison