Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e08FL-0001m9-HS for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Oct 2017 15:39:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1e08FK-0006FP-Si for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Oct 2017 15:39:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e08Ea-0003g8-Re for pgsql-bugs@postgresql.org; Thu, 05 Oct 2017 15:38:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1e08EW-0003ck-KH for pgsql-bugs@postgresql.org; Thu, 05 Oct 2017 15:38:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v95FceJZ008638; Thu, 5 Oct 2017 11:38:40 -0400 From: Tom Lane To: Michael Paquier cc: Ben Chobot , PostgreSQL mailing lists , Andres Freund Subject: Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql In-reply-to: References: <73FBA179-C68C-4540-9473-71E865408B15@silentmedia.com> Comments: In-reply-to Michael Paquier message dated "Thu, 05 Oct 2017 14:45:53 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8636.1507217920.1@sss.pgh.pa.us> Date: Thu, 05 Oct 2017 11:38:40 -0400 Message-ID: <8637.1507217920@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Michael Paquier writes: > This looks like a legit bug to me. Andres, any opinions? I wonder why ReorderBufferCommit does this: if (using_subtxn) BeginInternalSubTransaction("replay"); else StartTransactionCommand(); and then tries to clean that up with this brain-dead-looking sequence: AbortCurrentTransaction(); /* make sure there's no cache pollution */ ReorderBufferExecuteInvalidations(rb, txn); if (using_subtxn) RollbackAndReleaseCurrentSubTransaction(); Shouldn't that be something like if (using_subtxn) RollbackAndReleaseCurrentSubTransaction(); else AbortCurrentTransaction(); ? Although by this theory, the using_subtxn path has never worked, not even a little bit, which seems somewhat unlikely. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs