pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vik Fearing <vik@postgresfriends.org>
To: Alexandre Bailly <alexandrebailly1955@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19003: A SELECT that does not return a valid table
Date: Thu, 31 Jul 2025 15:10:09 +0200
Message-ID: <7c12b589-2b59-4a37-b1de-ee2d906c6d7a@postgresfriends.org> (raw)
In-Reply-To: <CADZkWe1Ya2UCz6X87ikNHsD0PdKxiXJQ5vGWFWO4w6uyzdZvHA@mail.gmail.com>
References: <19003-17a559220b959ea1@postgresql.org>
	<1675174.1753911281@sss.pgh.pa.us>
	<bd9a5a27-e020-4975-8c46-0c30a67bff50@postgresfriends.org>
	<CADZkWe1Ya2UCz6X87ikNHsD0PdKxiXJQ5vGWFWO4w6uyzdZvHA@mail.gmail.com>


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

view thread (6+ messages)

Message-ID: <7c12b589-2b59-4a37-b1de-ee2d906c6d7a@postgresfriends.org>
Permalink:  ../7c12b589-2b59-4a37-b1de-ee2d906c6d7a@postgresfriends.org/
Also on:    postgresql.org/message-id/7c12b589-2b59-4a37-b1de-ee2d906c6d7a@postgresfriends.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: vik@postgresfriends.org, alexandrebailly1955@gmail.com, tgl@sss.pgh.pa.us, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #19003: A SELECT that does not return a valid table
  In-Reply-To: <7c12b589-2b59-4a37-b1de-ee2d906c6d7a@postgresfriends.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox