diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/combocid.out | 27 | ||||
| -rw-r--r-- | src/test/regress/sql/combocid.sql | 18 |
2 files changed, 45 insertions, 0 deletions
diff --git a/src/test/regress/expected/combocid.out b/src/test/regress/expected/combocid.out index b63894c2837..17eb94a8ffc 100644 --- a/src/test/regress/expected/combocid.out +++ b/src/test/regress/expected/combocid.out @@ -140,3 +140,30 @@ SELECT ctid,cmin,* FROM combocidtest; (0,6) | 0 | 444 (3 rows) +-- test for bug reported in +-- CABRT9RC81YUf1=jsmWopcKJEro=VoeG2ou6sPwyOUTx_qteRsg@mail.gmail.com +CREATE TABLE IF NOT EXISTS testcase( + id int PRIMARY KEY, + balance numeric +); +INSERT INTO testcase VALUES (1, 0); +BEGIN; +SELECT * FROM testcase WHERE testcase.id = 1 FOR UPDATE; + id | balance +----+--------- + 1 | 0 +(1 row) + +UPDATE testcase SET balance = balance + 400 WHERE id=1; +SAVEPOINT subxact; +UPDATE testcase SET balance = balance - 100 WHERE id=1; +ROLLBACK TO SAVEPOINT subxact; +-- should return one tuple +SELECT * FROM testcase WHERE id = 1 FOR UPDATE; + id | balance +----+--------- + 1 | 400 +(1 row) + +ROLLBACK; +DROP TABLE testcase; diff --git a/src/test/regress/sql/combocid.sql b/src/test/regress/sql/combocid.sql index f24ac6b01a1..4faea36f41a 100644 --- a/src/test/regress/sql/combocid.sql +++ b/src/test/regress/sql/combocid.sql @@ -91,3 +91,21 @@ SELECT ctid,cmin,* FROM combocidtest; COMMIT; SELECT ctid,cmin,* FROM combocidtest; + +-- test for bug reported in +-- CABRT9RC81YUf1=jsmWopcKJEro=VoeG2ou6sPwyOUTx_qteRsg@mail.gmail.com +CREATE TABLE IF NOT EXISTS testcase( + id int PRIMARY KEY, + balance numeric +); +INSERT INTO testcase VALUES (1, 0); +BEGIN; +SELECT * FROM testcase WHERE testcase.id = 1 FOR UPDATE; +UPDATE testcase SET balance = balance + 400 WHERE id=1; +SAVEPOINT subxact; +UPDATE testcase SET balance = balance - 100 WHERE id=1; +ROLLBACK TO SAVEPOINT subxact; +-- should return one tuple +SELECT * FROM testcase WHERE id = 1 FOR UPDATE; +ROLLBACK; +DROP TABLE testcase; |
