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:
@@ -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
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user