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 1nh14l-0008OE-Bg for pgsql-general@arkaria.postgresql.org; Wed, 20 Apr 2022 03:32:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nh14j-0003Dq-Qd for pgsql-general@arkaria.postgresql.org; Wed, 20 Apr 2022 03:32:17 +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 1nh14j-0003Dh-GO for pgsql-general@lists.postgresql.org; Wed, 20 Apr 2022 03:32:17 +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 1nh14d-00056f-4Y for pgsql-general@lists.postgresql.org; Wed, 20 Apr 2022 03:32:16 +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 23K3W8Um2715949; Tue, 19 Apr 2022 23:32:08 -0400 From: Tom Lane To: "David G. Johnston" cc: Julien Rouhaud , Bryn Llewellyn , pgsql-general list Subject: Re: =?UTF-8?Q?Re=3A_Unexpected_result_from_ALTER_FUNCTION=E2=80=94_looks_l?= =?UTF-8?Q?ike_a_bug?= In-reply-to: References: <8AC9A37F-99BD-446F-A2F7-B89AD0022774@yugabyte.com> <20220420024707.zvhpbr5ztermdmm6@jrouhaud> Comments: In-reply-to "David G. Johnston" message dated "Tue, 19 Apr 2022 20:15:18 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2715947.1650425528.1@sss.pgh.pa.us> Date: Tue, 19 Apr 2022 23:32:08 -0400 Message-ID: <2715948.1650425528@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "David G. Johnston" writes: > Might I suggest the following: > + /* > + * For each action, modify procForm to type-safely set the new value. > + * However, because the SET clause is repeatable we handle it > + * a bit differently, modifying the underlying tuple directly. So > + * make sure to leave that conditional block for last. + */ Actually, the reason proconfig is handled differently is that it's a variable-length field, so it can't be represented in the C struct that we overlay onto the catalog tuple to access the fixed-width fields cheaply. I'm not sure that insisting that that stanza be last is especially useful advice for future hackers, because someday there might be more than one variable-length field that this function needs to update. regards, tom lane