Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable

Поиск
Список
Период
Сортировка
От Delaney, Ed
Тема Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable
Дата
Msg-id DM8PR02MB7957E9EB0AF94B614520989EF1349@DM8PR02MB7957.namprd02.prod.outlook.com
обсуждение исходный текст
Ответ на Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs

Thanks for the timely replies.

I've found that either removing the length specification or the cast addresses the issue.
So this all makes sense to me.


I could not find a reference to this change in the release notes, but since it is a breaking change, perhaps it should be noted?

regards

Ed

 

From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Monday, February 14, 2022 at 6:28 PM
To: Delaney, Ed <Ed.Delaney@ellucian.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: [EXT]: Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable

"Delaney, Ed" <Ed.Delaney@ellucian.com> writes:
> create or replace procedure bar ()
> language plpgsql
> as $procedure$
> declare
>   lv_somestring character varying (4000);
> begin
>    call foo(lv_somestring::character varying);  -- note cast
>    raise notice 'lv_somestring: %', lv_somestring;
> end;
> $procedure$;

I think you're out of luck on that.  Releases before last November
ignored that cast entirely, thinking it a no-op.  Current releases
do not ignore it, recognizing that in fact it has to be understood
as casting to varchar-of-unspecified-length.  But then the argument
isn't a bare variable anymore.

We debated about whether to back-patch such a behavioral change,
and maybe we shouldn't have.  But there are scenarios in which
the old behavior makes it just impossible to do things, eg you
may not be able to get a UNION to produce the desired type.
On balance we felt this was a bug fix.

                        regards, tom lane

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

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #17406: Segmentation fault on GiST index after 14.2 upgrade
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable