Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJklq-00059X-FE for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Feb 2022 23:28:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nJklp-0007cP-7s for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Feb 2022 23:28:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJklo-0007a9-VC for pgsql-bugs@lists.postgresql.org; Mon, 14 Feb 2022 23:28:36 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nJklm-0006lF-L2 for pgsql-bugs@lists.postgresql.org; Mon, 14 Feb 2022 23:28:36 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 21ENSTqf2959723; Mon, 14 Feb 2022 18:28:29 -0500 From: Tom Lane To: "Delaney, Ed" cc: "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: References: Comments: In-reply-to "Delaney, Ed" message dated "Mon, 14 Feb 2022 22:50:06 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2959721.1644881309.1@sss.pgh.pa.us> Date: Mon, 14 Feb 2022 18:28:29 -0500 Message-ID: <2959722.1644881309@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "Delaney, Ed" 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