Re: CTE containing ambiguous columns

Поиск
Список
Период
Сортировка
От 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 по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: EOL for 7.4?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Patch committers