From: Tom Lane <tgl@sss.pgh.pa.us>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Erki Eessaar <erki.eessaar@taltech.ee>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: References to parameters by name are lost in INSERT INTO ... SELECT <parameter value> .... statements in case of routines with the SQL-standard function body
Date: Wed, 17 Nov 2021 11:33:47 -0500
Message-ID: <2520161.1637166827@sss.pgh.pa.us> (raw)
In-Reply-To: <CAD21AoCVVbqkZO2t6rVaE9Xa5r-4H65z8scqJs0X10=RnZRZMg@mail.gmail.com>
References: <AM9PR01MB8268347BED344848555167FAFE949@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>
<CAD21AoCP04K5C_DhOqMdhcryoYxsh__oV3NaJmKbpyxirOeeBw@mail.gmail.com>
<AM9PR01MB82684DD5CCD1C8653D42149CFE999@AM9PR01MB8268.eurprd01.prod.exchangelabs.com>
<2345766.1637099577@sss.pgh.pa.us>
<CAD21AoCVVbqkZO2t6rVaE9Xa5r-4H65z8scqJs0X10=RnZRZMg@mail.gmail.com>
Masahiko Sawada <sawada.mshk@gmail.com> writes:
> On Wed, Nov 17, 2021 at 6:52 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Yeah, it's weird that the same parameter is printed two different ways.
>> I dug into it and found out that we're losing the "context->namespace"
>> list when recursing into the sub-SELECT from get_insert_query_def.
>> The fix is trivial (attached). The other places where get_query_def is
>> invoked quasi-recursively all pass down the parent namespace list already.
>> The fact that this one is out of step is a very ancient oversight (it's
>> at least old enough to vote, according to some quick git archaeology).
>> But as far as I can see, it didn't have any visible consequences until
>> commit e717a9a18 taught get_parameter() to pay attention to the last
>> entry of the list. So I'm inclined not to change it before v14.
> Agreed. I've confirmed by the attached test that the patch fixes this issue.
Pushed, thanks for writing the test case.
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, sawada.mshk@gmail.com, erki.eessaar@taltech.ee, pgsql-bugs@lists.postgresql.org, peter.eisentraut@enterprisedb.com
Subject: Re: References to parameters by name are lost in INSERT INTO ... SELECT <parameter value> .... statements in case of routines with the SQL-standard function body
In-Reply-To: <2520161.1637166827@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