Re: References to parameters by name are lost in INSERT INTO ... SELECT .... statements in case of routines with the SQL-standard function body

Поиск
Список
Период
Сортировка
От Masahiko Sawada
Тема Re: References to parameters by name are lost in INSERT INTO ... SELECT .... statements in case of routines with the SQL-standard function body
Дата
Msg-id CAD21AoCVVbqkZO2t6rVaE9Xa5r-4H65z8scqJs0X10=RnZRZMg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: References to parameters by name are lost in INSERT INTO ... SELECT .... statements in case of routines with the SQL-standard function body  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: References to parameters by name are lost in INSERT INTO ... SELECT .... statements in case of routines with the SQL-standard function body  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Wed, Nov 17, 2021 at 6:52 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Erki Eessaar <erki.eessaar@taltech.ee> writes:
> > Indeed, re-execution of this code without any modifications in it produces the same result.
>
> Right, that printout is functionally equivalent to the original.
>
> > Still I see here two problems.
> >   *   Inconsistency - see INSERT vs. UPDATE.
>
> 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.

Regards,

-- 
Masahiko Sawada
EDB:  https://www.enterprisedb.com/

Вложения

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: BUG #17255: Server crashes in index_delete_sort_cmp() due to race condition with vacuum
Следующее
От: Дмитрий Иванов
Дата:
Сообщение: Re: pg_restore depending on user functions