Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Ben Chobot <bench(at)silentmedia(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql
Date: 2017-10-05 15:38:40
Message-ID: 8637.1507217920@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Michael Paquier <michael(dot)paquier(at)gmail(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2017-10-05 21:10:58 Re: pg_logical_slot_peek_changes crashes postgres when called from inside pl/pgsql
Previous Message Robert Haas 2017-10-05 13:45:14 Re: [HACKERS] BUG #14825: enum type: unsafe use?