| От | Tom Lane |
|---|---|
| Тема | Re: CTE containing ambiguous columns |
| Дата | |
| Msg-id | 25460.1258093526@sss.pgh.pa.us обсуждение |
| Ответ на | CTE containing ambiguous columns (Robert Haas <robertmhaas@gmail.com>) |
| Список | pgsql-hackers |
Robert Haas <robertmhaas@gmail.com> writes:
> Suppose you do this:
> create table animals (id serial primary key, name varchar not null);
> Then you can do this:
> with beings as (select * from animals) select * from beings where id = 1;
> But not this:
> with beings as (select * from animals a1, animals a2) select * from
> beings where id = 1;
No different from
regression=# select * from (animals a1 cross join animals a2) x where id = 1;
ERROR: column reference "id" is ambiguous
LINE 1: ...ct * from (animals a1 cross join animals a2) x where id = 1;
^
There's no way to access the a1/a2 aliases here, either; and that rule
goes back to SQL92 or maybe further.
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера