1# Test NOWAIT with an updated tuple chain. 2 3setup 4{ 5 CREATE TABLE foo ( 6 id int PRIMARY KEY, 7 data text NOT NULL 8 ); 9 INSERT INTO foo VALUES (1, 'x'); 10} 11 12teardown 13{ 14 DROP TABLE foo; 15} 16 17session s1 18setup { BEGIN; } 19step s1a { SELECT * FROM foo WHERE pg_advisory_lock(0) IS NOT NULL FOR UPDATE NOWAIT; } 20step s1b { COMMIT; } 21 22session s2 23step s2a { SELECT pg_advisory_lock(0); } 24step s2b { UPDATE foo SET data = data; } 25step s2c { BEGIN; } 26step s2d { UPDATE foo SET data = data; } 27step s2e { SELECT pg_advisory_unlock(0); } 28step s2f { COMMIT; } 29 30# s1 takes a snapshot but then waits on an advisory lock, then s2 31# updates the row in one transaction, then again in another without 32# committing, before allowing s1 to proceed to try to lock a row; 33# because it has a snapshot that sees the older version, we reach the 34# waiting code in EvalPlanQualFetch which ereports when in NOWAIT mode. 35permutation s2a s1a s2b s2c s2d s2e s1b s2f 36