pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Delaney, Ed <Ed.Delaney@ellucian.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable
Date: Mon, 14 Feb 2022 18:28:29 -0500
Message-ID: <2959722.1644881309@sss.pgh.pa.us> (raw)
In-Reply-To: <DM8PR02MB79575CE6CE819DB8C424CCABF1339@DM8PR02MB7957.namprd02.prod.outlook.com>
References: <DM8PR02MB79575CE6CE819DB8C424CCABF1339@DM8PR02MB7957.namprd02.prod.outlook.com>

"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





view thread (5+ messages)  latest in thread

Message-ID: <2959722.1644881309@sss.pgh.pa.us>
Permalink:  ../2959722.1644881309@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2959722.1644881309@sss.pgh.pa.us

 · 

reply

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, Ed.Delaney@ellucian.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: Postgres 13.5 out parameter argument with explicit cast fails with argument is not writable
  In-Reply-To: <2959722.1644881309@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