Re: Possible wrong result with some "in" subquery with non-existing columns
В списке pgsql-bugs по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: Possible wrong result with some "in" subquery with non-existing columns |
| Дата | |
| Msg-id | 2915686.1673942658@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Possible wrong result with some "in" subquery with non-existing columns ("Xiong He" <iihero@qq.com>) |
| Ответы |
Re: Possible wrong result with some "in" subquery with non-existing columns
|
| Список | pgsql-bugs |
"=?ISO-8859-1?B?WGlvbmcgSGU=?=" <iihero@qq.com> writes:
> mydb=# create table test1(id1 int primary key, col2 varchar(32));
> mydb=# create table test2(id2 int primary key, col2 varchar(32));
> mydb=# select * from test1 where id1 in (select id1 from test2 where id2 = 2);
> In the above query: id1 is not a column of table test2.
Nope, but it's a legal outer reference.
> Should not we expect this should be en error instead of it thinking it's a column from the table : test1?
This behavior is required by the SQL standard, and has been for
decades. Yes, it trips up novices all the time, but it does
have valid use-cases.
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера