Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable
Date
Msg-id 2959722.1644881309@sss.pgh.pa.us
Whole thread Raw
In response to Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable  ("Delaney, Ed" <Ed.Delaney@ellucian.com>)
Responses Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable  ("Delaney, Ed" <Ed.Delaney@ellucian.com>)
List pgsql-bugs
"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 by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable
Next
From: Andres Freund
Date:
Subject: Re: BUG #17391: While using --with-ssl=openssl and PG_TEST_EXTRA='ssl' options, SSL tests fail on OpenBSD 7.0