Add EvalPlanQual delete returning isolation test

Author: Andres Freund
Reviewed-by: Pavel Borisov
Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdua-YFw3XTprfutzGp28xXLigFtzNbuFY8yPhqeq6X5kg%40mail.gmail.com
This commit is contained in:
Alexander Korotkov 2024-03-26 01:28:05 +02:00
parent 87985cc925
commit 8ffc2aa720
2 changed files with 34 additions and 0 deletions

View File

@ -746,6 +746,36 @@ savings | 600| 1200
(2 rows) (2 rows)
starting permutation: read wx2 wb1 c2 c1 read
step read: SELECT * FROM accounts ORDER BY accountid;
accountid|balance|balance2
---------+-------+--------
checking | 600| 1200
savings | 600| 1200
(2 rows)
step wx2: UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking' RETURNING balance;
balance
-------
1050
(1 row)
step wb1: DELETE FROM accounts WHERE balance = 600 RETURNING *; <waiting ...>
step c2: COMMIT;
step wb1: <... completed>
accountid|balance|balance2
---------+-------+--------
savings | 600| 1200
(1 row)
step c1: COMMIT;
step read: SELECT * FROM accounts ORDER BY accountid;
accountid|balance|balance2
---------+-------+--------
checking | 1050| 2100
(1 row)
starting permutation: upsert1 upsert2 c1 c2 read starting permutation: upsert1 upsert2 c1 c2 read
step upsert1: step upsert1:
WITH upsert AS WITH upsert AS

View File

@ -76,6 +76,8 @@ setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
step wx1 { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking' RETURNING balance; } step wx1 { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking' RETURNING balance; }
# wy1 then wy2 checks the case where quals pass then fail # wy1 then wy2 checks the case where quals pass then fail
step wy1 { UPDATE accounts SET balance = balance + 500 WHERE accountid = 'checking' RETURNING balance; } step wy1 { UPDATE accounts SET balance = balance + 500 WHERE accountid = 'checking' RETURNING balance; }
# wx2 then wb1 checks the case of re-fetching up-to-date values for DELETE ... RETURNING ...
step wb1 { DELETE FROM accounts WHERE balance = 600 RETURNING *; }
step wxext1 { UPDATE accounts_ext SET balance = balance - 200 WHERE accountid = 'checking' RETURNING balance; } step wxext1 { UPDATE accounts_ext SET balance = balance - 200 WHERE accountid = 'checking' RETURNING balance; }
step tocds1 { UPDATE accounts SET accountid = 'cds' WHERE accountid = 'checking'; } step tocds1 { UPDATE accounts SET accountid = 'cds' WHERE accountid = 'checking'; }
@ -353,6 +355,8 @@ permutation wx1 delwcte c1 c2 read
# test that a delete to a self-modified row throws error when # test that a delete to a self-modified row throws error when
# previously updated by a different cid # previously updated by a different cid
permutation wx1 delwctefail c1 c2 read permutation wx1 delwctefail c1 c2 read
# test that a delete re-fetches up-to-date values for returning clause
permutation read wx2 wb1 c2 c1 read
permutation upsert1 upsert2 c1 c2 read permutation upsert1 upsert2 c1 c2 read
permutation readp1 writep1 readp2 c1 c2 permutation readp1 writep1 readp2 c1 c2