# A catalog change committed in BUILDING_SNAPSHOT, then decoding after the # slot reaches CONSISTENT, with no further catalog change until the ANALYZE. setup { DROP TABLE IF EXISTS t, nk; CREATE TABLE t (id int PRIMARY KEY, a text); CREATE TABLE nk (id int, a text); INSERT INTO nk VALUES (11, 'x'), (12, 'y'); } teardown { DROP TABLE t, nk; SELECT 'stop' FROM pg_drop_replication_slot('isolation_slot'); } session "s1" step "s1_begin" { BEGIN; SELECT pg_current_xact_id() IS NULL; } step "s1_commit" { COMMIT; } session "s2" step "s2_init" { SELECT 'init' FROM pg_create_logical_replication_slot('isolation_slot', 'test_decoding'); } step "s2_peek" { SELECT data FROM pg_logical_slot_peek_changes('isolation_slot', NULL, NULL, 'skip-empty-xacts', '1', 'include-xids', '0') WHERE data LIKE 'table%'; } session "s3" step "s3_begin" { BEGIN; SELECT pg_current_xact_id() IS NULL; } step "s3_commit" { COMMIT; } session "s4" step "s4_ddl" { ALTER TABLE t ADD COLUMN b int; } step "s4_truncate" { TRUNCATE nk; } step "s4_refill" { INSERT INTO nk VALUES (11, 'x'), (12, 'y'); } step "s4_begin" { BEGIN; } step "s4_straddle" { INSERT INTO t VALUES (1, 'straddles', 2); } step "s4_commit" { COMMIT; } step "s4_after" { INSERT INTO t VALUES (2, 'after consistent', 3); } step "s4_checkpoint" { CHECKPOINT; } step "s4_after_ckpt" { INSERT INTO t VALUES (3, 'after checkpoint', 4); } step "s4_delete" { DELETE FROM nk WHERE id = 11; } step "s4_analyze" { ANALYZE t; } step "s4_after_analyze" { INSERT INTO t VALUES (4, 'after analyze', 5); } permutation "s1_begin" "s2_init" "s3_begin" "s4_ddl" "s4_truncate" "s4_refill" "s1_commit" "s4_begin" "s4_straddle" "s3_commit" "s4_commit" "s4_after" "s4_checkpoint" "s4_after_ckpt" "s4_delete" "s4_analyze" "s4_after_analyze" "s2_peek"