Re: BUG #19003: A SELECT that does not return a valid table - Mailing list pgsql-bugs

From Vik Fearing
Subject Re: BUG #19003: A SELECT that does not return a valid table
Date
Msg-id 7c12b589-2b59-4a37-b1de-ee2d906c6d7a@postgresfriends.org
Whole thread Raw
In response to Re: BUG #19003: A SELECT that does not return a valid table  (Alexandre Bailly <alexandrebailly1955@gmail.com>)
List 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 by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: BUG #18988: DROP SUBSCRIPTION locks not-yet-accessed database
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #19000: gist index returns inconsistent result with gist_inet_ops