-- @Description Tests that a update operation in progress will block all other updates -- until the transaction is committed. -- DROP TABLE IF EXISTS ao; DROP CREATE TABLE ao (a INT, b INT) WITH (appendonly=true); CREATE INSERT INTO ao SELECT i as a, i as b FROM generate_series(1,10) AS i; INSERT 10 DROP VIEW IF EXISTS locktest; DROP create view locktest as select coalesce( case when relname like 'pg_toast%index' then 'toast index' when relname like 'pg_toast%' then 'toast table' else relname end, 'dropped table'), mode, locktype from pg_locks l left outer join pg_class c on (l.relation = c.oid), pg_database d where relation is not null and l.database = d.oid and l.gp_segment_id = -1 and relname != 'gp_fault_strategy' and d.datname = current_database() order by 1, 3, 2; CREATE -- The actual test begins 1: BEGIN; BEGIN 2: BEGIN; BEGIN 2: UPDATE ao SET b = 42 WHERE a = 1; UPDATE 1 2: SELECT * FROM locktest WHERE coalesce = 'ao'; coalesce|mode |locktype --------+-------------------+------------------------ ao |AccessExclusiveLock|append-only segment file ao |ExclusiveLock |relation (2 rows) 1&: UPDATE ao SET b = 42 WHERE a = 2; 2: COMMIT; COMMIT 1<: <... completed> UPDATE 1 1: COMMIT; COMMIT 3: SELECT * FROM ao WHERE a < 5 ORDER BY a; a|b -+-- 1|42 2|42 3|3 4|4 (4 rows) 2U: SELECT * FROM gp_toolkit.__gp_aovisimap_name('ao'); tid |segno|row_num ----------------+-----+------- (33554432,32769)|1 |1 (1 row)