| 1 |
-- predictability |
| 2 |
SET synchronous_commit = on; |
| 3 |
|
| 4 |
SELECT 'init' FROM pg_create_logical_replication_slot('regression_slot', 'test_decoding'); |
| 5 |
|
| 6 |
CREATE TABLE xact_test(data text); |
| 7 |
INSERT INTO xact_test VALUES ('before-test'); |
| 8 |
|
| 9 |
-- bug #13844, xids in non-decoded records need to be inspected |
| 10 |
BEGIN; |
| 11 |
-- perform operation in xact that creates and logs xid, but isn't decoded |
| 12 |
SELECT * FROM xact_test FOR UPDATE; |
| 13 |
SAVEPOINT foo; |
| 14 |
-- and now actually insert in subxact, xid is expected to be known |
| 15 |
INSERT INTO xact_test VALUES ('after-assignment'); |
| 16 |
COMMIT; |
| 17 |
-- and now show those changes |
| 18 |
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1'); |
| 19 |
|
| 20 |
-- bug #14279, do not propagate null snapshot from subtransaction |
| 21 |
BEGIN; |
| 22 |
-- first insert |
| 23 |
INSERT INTO xact_test VALUES ('main-txn'); |
| 24 |
SAVEPOINT foo; |
| 25 |
-- now perform operation in subxact that creates and logs xid, but isn't decoded |
| 26 |
SELECT 1 FROM xact_test FOR UPDATE LIMIT 1; |
| 27 |
COMMIT; |
| 28 |
-- and now show those changes |
| 29 |
SELECT data FROM pg_logical_slot_get_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1'); |
| 30 |
|
| 31 |
DROP TABLE xact_test; |
| 32 |
|
| 33 |
SELECT pg_drop_replication_slot('regression_slot'); |