public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: Robert Haas <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: ExecTypeSetColNames is fundamentally broken
Date: Tue, 07 Dec 2021 13:19:29 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+TgmoYX8ZsL5BoYeJD+QK9iCQLBdq1mbQ_ZiwZGKBwzgFZYWA@mail.gmail.com>
References: <[email protected]>
	<CA+TgmoaYDAqLLmxo_d9h2SZ1Mw28M9w5QZMuZcaL6D2JdG_B6w@mail.gmail.com>
	<[email protected]>
	<CA+Tgmoa2Fm+4eDb6O4NFzA-u78k2Wa0-V48qimSVgBbCF2MvDg@mail.gmail.com>
	<[email protected]>
	<CA+TgmoYX8ZsL5BoYeJD+QK9iCQLBdq1mbQ_ZiwZGKBwzgFZYWA@mail.gmail.com>

Robert Haas <[email protected]> writes:
> On Tue, Dec 7, 2021 at 12:30 PM Tom Lane <[email protected]> wrote:
>> If we consider that the alias renames the columns "for all purposes",
>> how is it okay for f() to select the "a" column?

> I'd say it isn't.

In a green field I'd probably agree with you, but IMO that will
break far too much existing SQL code.

It'd cause problems for us too, not only end-users.  As an example,
ruleutils.c would have to avoid attaching new column aliases to
tables that are referenced as whole-row Vars.  I'm not very sure
that that's even possible without creating insurmountable ambiguity
issues.  There are also fun issues around what happens to a stored
query after a table column rename.  Right now the query acts as
though it uses the old name as a column alias, and that introduces
no semantic problem; but that behavior would no longer be
acceptable.

So the alternatives I see are to revert what bf7ca1587 tried to do
here, or to try to make it work that way across-the-board, which
implies (a) a very much larger amount of work, and (b) breaking
important behaviors that are decades older than that commit.
It's not even entirely clear that we could get to complete
consistency if we went down that path.

			regards, tom lane





view thread (9+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: ExecTypeSetColNames is fundamentally broken
  In-Reply-To: <[email protected]>

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

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