From: Vik Fearing <vik@postgresfriends.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: alexandrebailly1955@gmail.com
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19003: A SELECT that does not return a valid table
Date: Thu, 31 Jul 2025 11:17:14 +0200
Message-ID: <bd9a5a27-e020-4975-8c46-0c30a67bff50@postgresfriends.org> (raw)
In-Reply-To: <1675174.1753911281@sss.pgh.pa.us>
References: <19003-17a559220b959ea1@postgresql.org>
<1675174.1753911281@sss.pgh.pa.us>
On 30/07/2025 23:34, Tom Lane wrote:
> PG Bug reporting form<noreply@postgresql.org> writes:
>> SELECT 'John' AS nom,'James' AS nom
>> returns a table with attributes nom and nom that I can see in the output.
>> Returning a table that contains twice the same column should not be
>> permitted.
> There is pretty much zero chance that we will enforce that
> restriction. It would break too much application code.
> Also, it looks to me like there is no such requirement in
> the SQL standard.
Indeed. In SQL:2023-1 (available free of charge at [1]) says in
Subclause 4.6, "Tables":
"An operation that references zero or more base tables and returns
a table is called a *query*. The result of a query is called a *derived
table*."
and
"Derived tables, other than viewed tables, may contain more than
one column with the same name."
So, not only is this not a bug we should fix, it is explicitly allowed
by the standard.
[1] https://www.iso.org/standard/76583.html
--
Vik Fearing
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, tgl@sss.pgh.pa.us, alexandrebailly1955@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #19003: A SELECT that does not return a valid table
In-Reply-To: <bd9a5a27-e020-4975-8c46-0c30a67bff50@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