blob: 829c96b3dc545996cc2455e14437cba759b1de5f [file] [log] [blame]
--
-- Test for a bug in checking tuple visibility against a distributed snapshot
-- that turned up during merge PostgreSQL 9.6. We incorrectly set the
-- HEAP_XMAX_DISTRIBUTED_SNAPSHOT_IGNORE hint bit on a tuple, when the
-- transaction was in fact a distributed transaction that was still
-- in-progress.
--
CREATE TABLE distributed_snapshot_test ( id INTEGER, f FLOAT);
CREATE
1: BEGIN;
BEGIN
2: BEGIN;
BEGIN
2: SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET
2: select 'dummy select to establish snapshot';
?column?
------------------------------------
dummy select to establish snapshot
(1 row)
1: select count(*) > 0 as tbl_found from gp_dist_random('pg_class') where relname = 'distributed_snapshot_test';
tbl_found
-----------
t
(1 row)
-- Drop table in a transaction
1: drop table distributed_snapshot_test;
DROP
3: vacuum pg_class;
VACUUM
-- Commit the DROP.
1: COMMIT;
COMMIT
-- The table should still be visible to transaction 2's snapshot.
2: select count(*) > 0 as tbl_found from gp_dist_random('pg_class') where relname = 'distributed_snapshot_test';
tbl_found
-----------
t
(1 row)