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