PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID15808
PG Version10.6
OSAmazon RDS
Opened2019-05-16 04:56:15+00
Reported byMansour Behabadi
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      15808
Logged by:          Mansour Behabadi
Email address:      (redacted)
PostgreSQL version: 10.6
Operating system:   Amazon RDS
Description:        

We have some custom logical replication client that makes
pg_logical_slot_get_changes() calls in SQL. E.g.:

select max(1) from pg_logical_slot_get_changes('testslot', '5754/E9332B68',
1000);

Once every few thousand calls, we get the following error:

ERROR: subtransaction logged without previous top-level txn record (SQLSTATE
XX000)

which will persist on all subsequent calls, essentially forcing us to drop
the slot and create a new one.

We had little success looking for solutions online and the only lead is that
of a recent commit
(https://github.com/postgres/postgres/commit/f49a80c481f74fa81407dce8e51dea6956cb64f8)
whose commit message seem to correlate to the error we're getting. Below is
the relevant excerpt:

The second issue concerns SnapBuilder snapshots and subtransactions.
SnapBuildDistributeNewCatalogSnapshot never assigned a snapshot to a
transaction that is known to be a subtxn, which is good in the common
case that the top-level transaction already has one (no point in doing
so), but a bug otherwise.  To fix, arrange to transfer the snapshot from
the subtxn to its top-level txn as soon as the kinship gets known.
test_decoding's snapshot_transfer verifies this.

We're not sure if this is a fix to our problem and whether upgrading to
Postgres 11 (which has this change in it) will solve the issue.

Please let me know if any more info is needed.

Messages

DateAuthorSubject
2019-05-16 04:56:15+00PG Bug reporting formBUG #15808: ERROR: subtransaction logged without previous top-level txn record (SQLSTATE XX000)
2019-05-16 17:04:34+00Andres FreundRe: BUG #15808: ERROR: subtransaction logged without previous top-level txn record (SQLSTATE XX000)
2019-09-06 20:39:15+00Dave CramerRe: BUG #15808: ERROR: subtransaction logged without previous top-level txn record (SQLSTATE XX000)
2019-09-06 23:36:19+00"Hsu, John"Re: BUG #15808: ERROR: subtransaction logged without previous top-level txn record (SQLSTATE XX000)