Re: BUG #19003: A SELECT that does not return a valid table

Поиск
Список
Период
Сортировка
От Vik Fearing
Тема Re: BUG #19003: A SELECT that does not return a valid table
Дата
Msg-id 7c12b589-2b59-4a37-b1de-ee2d906c6d7a@postgresfriends.org
обсуждение исходный текст
Ответ на Re: BUG #19003: A SELECT that does not return a valid table  (Alexandre Bailly <alexandrebailly1955@gmail.com>)
Список pgsql-bugs


On 31/07/2025 12:50, Alexandre Bailly wrote:

WITH customer AS
(SELECT 'John' AS name,'James' AS name)
SELECT name FROM customer;

returns ERROR: column reference "name" is ambiguous

I can improve into

WITH customer(name1,name2) AS
(SELECT 'John' AS name,'James' AS name)
SELECT name2 FROM customer;

that returns name2 James.


Yes, a <with list element> is an inlined viewed table.


I am OK with SELECT 'John' AS name,'James' AS name returning 2 columns with the same name. 

I am not OK with the same query used as a sub-select.


Then don't do it?


Anyway, you have your answer to this bug report and that is: it is not a bug and we are not going to change it.

-- 

Vik Fearing

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