From: Tom Lane <tgl@sss.pgh.pa.us>
To: jian he <jian.universality@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: PetSerAl <petseral@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Record returning function accept not matched columns declaration
Date: Sun, 03 Mar 2024 19:40:01 -0500
Message-ID: <3419249.1709512801@sss.pgh.pa.us> (raw)
In-Reply-To: <CACJufxF8zDArmvc5Qsi+eCyXRFs1C-CiUpvqRShfxdmYqPZvNQ@mail.gmail.com>
References: <CAKygsHSerA1eXsJHR9wft3Gn3wfHQ5RfP8XHBzF70_qcrrRvEg@mail.gmail.com>
<CAKFQuwZ1-Ha1oHbHgveVgjNu6RWGQfVPNTO87y_=LxOmbyFBvA@mail.gmail.com>
<2741768.1709237477@sss.pgh.pa.us>
<CAKFQuwYs7f4OGJJXWCVEfjqab5U9vyZ-j-4oFJN-NJKzMKuKiw@mail.gmail.com>
<2756762.1709245862@sss.pgh.pa.us>
<2969212.1709315759@sss.pgh.pa.us>
<CACJufxF8zDArmvc5Qsi+eCyXRFs1C-CiUpvqRShfxdmYqPZvNQ@mail.gmail.com>
jian he <jian.universality@gmail.com> writes:
> On Sat, Mar 2, 2024 at 1:56 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I'm having mixed feelings about whether to back-patch this. Somebody
>> might complain that we broke a working query in a minor release.
> context: in postgres 9.3.25, dbfiddle[1]
> this query will fail:
> with a(b) as (values (row(1,2,3)))
> select * from a, coalesce(b) as c(d int, e int);
Sure, but in v12 and up (i.e., the supported versions that we might
back-patch into) the query succeeds, and it might not be obvious
to someone that its behavior isn't as-intended.
Admittedly, this seems like a rather contrived case. In cases
where the record-returning function call isn't reducible to a
constant, you'll get the expected error. So maybe I'm worrying
over something that no one is depending on in practice.
> I think by ExecMakeTableFunctionResult you mean `mainly
> ExecMakeTableFunctionResult's function: tupledesc_match`
> since ExecMakeTableFunctionResult is quite long.
Perhaps. I mentioned ExecMakeTableFunctionResult because that's
what's called directly from nodeFunctionscan.c. Referencing a
static function of another module is risky because it's pretty
unlikely the comment would get updated if refactoring in that
module makes it false.
regards, tom lane
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: tgl@sss.pgh.pa.us, jian.universality@gmail.com, david.g.johnston@gmail.com, petseral@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: Record returning function accept not matched columns declaration
In-Reply-To: <3419249.1709512801@sss.pgh.pa.us>
* 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