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 1nTpv3-0001sI-60 for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Mar 2022 18:59:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nTpv2-0006C4-2M for pgsql-bugs@arkaria.postgresql.org; Mon, 14 Mar 2022 18:59:48 +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 1nTpv1-0006Bv-Qi for pgsql-bugs@lists.postgresql.org; Mon, 14 Mar 2022 18:59:47 +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 1nTpuw-0004SE-Ig for pgsql-bugs@lists.postgresql.org; Mon, 14 Mar 2022 18:59:47 +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 22EIxbQH212335; Mon, 14 Mar 2022 14:59:37 -0400 From: Tom Lane To: Kyotaro Horiguchi cc: sawada.mshk@gmail.com, d.koval@postgrespro.ru, dilipbalaut@gmail.com, andrewbille@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17385: "RESET transaction_isolation" inside serializable transaction causes Assert at the transaction end In-reply-to: <170696.1647265517@sss.pgh.pa.us> References: <982894.1647028392@sss.pgh.pa.us> <20220314.173000.398225758850773114.horikyota.ntt@gmail.com> <170696.1647265517@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 14 Mar 2022 09:45:17 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <212333.1647284377.1@sss.pgh.pa.us> Date: Mon, 14 Mar 2022 14:59:37 -0400 Message-ID: <212334.1647284377@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk After thinking about this some more, it seems like there is a related problem with GUC save/restore actions. Consider regression=# create function foo() returns int language sql as 'select 1' regression-# set transaction_read_only = 1; CREATE FUNCTION regression=# begin; BEGIN regression=*# select foo(); foo ----- 1 (1 row) regression=*# show transaction_read_only; transaction_read_only ----------------------- off (1 row) transaction_read_only was set while we executed foo(), but now it's off again. I've not tried to weaponize this behavior, but if we have any optimizations that depend on transaction_read_only, this would probably break them. (SERIALIZABLE mode looks like a likely candidate for problems.) So it seems like we also need to forbid save/restore for these settings, which probably means rejecting action==GUC_ACTION_SAVE as well as value==NULL. That makes NO_RESET something of a misnomer, but I don't have an idea for a better name. regards, tom lane