pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Ben Chobot <bench@silentmedia.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Cc: Andres Freund <andres@anarazel.de>
Subject: Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql
Date: Thu, 05 Oct 2017 11:38:40 -0400
Message-ID: <8637.1507217920@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7nPqRZhE53NYVyOf5-WW6eoN9ZJhg6QeDDyfRfyZj4ESeQFA@mail.gmail.com>
References: <73FBA179-C68C-4540-9473-71E865408B15@silentmedia.com>
	<CAB7nPqRZhE53NYVyOf5-WW6eoN9ZJhg6QeDDyfRfyZj4ESeQFA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Michael Paquier <michael.paquier@gmail.com> 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



view thread (19+ messages)  latest in thread

Message-ID: <8637.1507217920@sss.pgh.pa.us>
Permalink:  ../8637.1507217920@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8637.1507217920@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, michael.paquier@gmail.com, bench@silentmedia.com, andres@anarazel.de
  Subject: Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql
  In-Reply-To: <8637.1507217920@sss.pgh.pa.us>
  References: <73FBA179-C68C-4540-9473-71E865408B15@silentmedia.com> <CAB7nPqRZhE53NYVyOf5-WW6eoN9ZJhg6QeDDyfRfyZj4ESeQFA@mail.gmail.com> <8637.1507217920@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