Re: Fix missing EvalPlanQual recheck for TID scans
Sophie Alpert <pg@sophiebits.com>
From: "Sophie Alpert" <pg@sophiebits.com>
To: "Chao Li" <li.evan.chao@gmail.com>
Cc: "David Rowley" <dgrowleyml@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-09-14T03:02:00Z
Lists: pgsql-hackers
On Sat, Sep 13, 2025 at 3:12 PM, Sophie Alpert <pg@sophiebits.com> wrote: > And indeed, like I mentioned in my previous message, my isolation test > `permutation tid1 tidsucceed2 c1 c2 read` from eval-plan-qual.spec in > my patch will fail if Recheck were to return false in this case. Though > somewhat contrived, you can imagine this happening with multiple > sessions driven by the same application: Another case where returning FALSE does not give the correct behavior is when two relations are involved, only one of which is modified: S1: BEGIN; S2: BEGIN; S1: UPDATE accounts SET balance = balance + 100 WHERE ctid = '(0,1)' RETURNING accountid, balance; S2: SELECT * FROM accounts JOIN accounts_ext USING (accountid) WHERE accounts_ext.ctid = '(0,1)' FOR UPDATE OF accounts; S1: COMMIT; S2: COMMIT; In my patch the S2 query correctly returns one row, whereas with your proposed change it incorrectly returns none. accountid|balance|balance2|balance|other|newcol|newcol2 ---------+-------+--------+-------+-----+------+------- checking | 700| 1400| 600|other| 42| Sophie
Commits
-
Add missing EPQ recheck for TID Range Scan
- f78a69034740 14.20 landed
- f00ad440a5b6 15.15 landed
- ba0203880a8f 16.11 landed
- 0fb06e893331 17.7 landed
- 78e6047dcea5 18.0 landed
- ac06ea8f7b6c 19 (unreleased) landed
-
Add missing EPQ recheck for TID Scan
- 940f3cd5df57 13.23 landed
- 2eb7ea97d8af 14.20 landed
- 005770203889 15.15 landed
- d6539f88b7c5 16.11 landed
- 3d939a9b1c72 17.7 landed
- bae6c74ba4e4 18.0 landed
- dee21ea6d617 19 (unreleased) landed
-
Repair problems with EvalPlanQual where target table is scanned as
- 6799a6ca21e5 7.2.1 cited
-
Tid access method feature from Hiroshi Inoue, Inoue@tpf.co.jp
- 6f9ff92cc0ff 7.1.1 cited