1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Handle duplicate XIDs in txid_snapshot.

The proc array can contain duplicate XIDs, when a transaction is just being
prepared for two-phase commit. To cope, remove any duplicates in
txid_current_snapshot(). Also ignore duplicates in the input functions, so
that if e.g. you have an old pg_dump file that already contains duplicates,
it will be accepted.

Report and fix by Jan Wieck. Backpatch to all supported versions.
This commit is contained in:
Heikki Linnakangas
2014-05-15 18:29:20 +03:00
parent 48fc8962f9
commit 19d7e8f07a
3 changed files with 54 additions and 17 deletions

View File

@@ -12,6 +12,12 @@ select '12:18:14,16'::txid_snapshot;
12:18:14,16
(1 row)
select '12:16:14,14'::txid_snapshot;
txid_snapshot
---------------
12:16:14
(1 row)
-- errors
select '31:12:'::txid_snapshot;
ERROR: invalid input for txid_snapshot: "31:12:"
@@ -29,10 +35,6 @@ select '12:16:14,13'::txid_snapshot;
ERROR: invalid input for txid_snapshot: "12:16:14,13"
LINE 1: select '12:16:14,13'::txid_snapshot;
^
select '12:16:14,14'::txid_snapshot;
ERROR: invalid input for txid_snapshot: "12:16:14,14"
LINE 1: select '12:16:14,14'::txid_snapshot;
^
create temp table snapshot_test (
nr integer,
snap txid_snapshot

View File

@@ -3,13 +3,13 @@
-- i/o
select '12:13:'::txid_snapshot;
select '12:18:14,16'::txid_snapshot;
select '12:16:14,14'::txid_snapshot;
-- errors
select '31:12:'::txid_snapshot;
select '0:1:'::txid_snapshot;
select '12:13:0'::txid_snapshot;
select '12:16:14,13'::txid_snapshot;
select '12:16:14,14'::txid_snapshot;
create temp table snapshot_test (
nr integer,