mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Relax overly strict assertion
Ever since its birth, ReorderBufferBuildTupleCidHash() has contained an assertion that a catalog tuple cannot change Cmax after acquiring one. But that's wrong: if a subtransaction executes DDL that affects that catalog tuple, and later aborts and another DDL affects the same tuple, it will change Cmax. Relax the assertion to merely verify that the Cmax remains valid and monotonically increasing, instead. Add a test that tickles the relevant code. Diagnosed by, and initial patch submitted by: Arseny Sher Co-authored-by: Arseny Sher Discussion: https://postgr.es/m/874l9p8hyw.fsf@ars-thinkpad
This commit is contained in:
@ -234,6 +234,19 @@ INSERT INTO tr_sub(path) VALUES ('5-top-1-#1');
|
||||
COMMIT;
|
||||
|
||||
|
||||
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
|
||||
|
||||
-- check that DDL in aborted subtransactions handled correctly
|
||||
CREATE TABLE tr_sub_ddl(data int);
|
||||
BEGIN;
|
||||
SAVEPOINT a;
|
||||
ALTER TABLE tr_sub_ddl ALTER COLUMN data TYPE text;
|
||||
INSERT INTO tr_sub_ddl VALUES ('blah-blah');
|
||||
ROLLBACK TO SAVEPOINT a;
|
||||
ALTER TABLE tr_sub_ddl ALTER COLUMN data TYPE bigint;
|
||||
INSERT INTO tr_sub_ddl VALUES(43);
|
||||
COMMIT;
|
||||
|
||||
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user