pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Add missing EPQ recheck for TID Range Scan 6+ messages / 1 participants [nested] [flat]
* pgsql: Add missing EPQ recheck for TID Range Scan @ 2025-09-17 00:19 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: David Rowley @ 2025-09-17 00:19 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer matches the clause of the scan. This isn't desired behavior, and isn't consistent with what would happen if the chosen plan had used an Index or Seq Scan, and that could lead to hard to predict behavior for scans that contain TID quals and other quals as the planner has freedom to choose TID Range or some other non-TID scan method for such queries, and the chosen plan could change at any moment. Here we fix this by properly implementing the recheck function for TID Range Scans. Backpatch to 14, where TID Range Scans were added Reported-by: Sophie Alpert <pg@sophiebits.com> Author: Sophie Alpert <pg@sophiebits.com> Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/4a6268ff-3340-453a-9bf5-c98d51a6f729@app.fastmail.com Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/ac06ea8f7b6c6aeedef9bff5fb30f606f6054a55 Modified Files -------------- src/backend/executor/nodeTidrangescan.c | 10 ++++++++++ src/test/isolation/expected/eval-plan-qual.out | 23 +++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 5 ++++- 3 files changed, 37 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Add missing EPQ recheck for TID Range Scan @ 2025-09-17 00:20 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: David Rowley @ 2025-09-17 00:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer matches the clause of the scan. This isn't desired behavior, and isn't consistent with what would happen if the chosen plan had used an Index or Seq Scan, and that could lead to hard to predict behavior for scans that contain TID quals and other quals as the planner has freedom to choose TID Range or some other non-TID scan method for such queries, and the chosen plan could change at any moment. Here we fix this by properly implementing the recheck function for TID Range Scans. Backpatch to 14, where TID Range Scans were added Reported-by: Sophie Alpert <pg@sophiebits.com> Author: Sophie Alpert <pg@sophiebits.com> Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/4a6268ff-3340-453a-9bf5-c98d51a6f729@app.fastmail.com Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/78e6047dcea588ec127f6a71c7cebd5c0f41d795 Modified Files -------------- src/backend/executor/nodeTidrangescan.c | 10 ++++++++++ src/test/isolation/expected/eval-plan-qual.out | 23 +++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 5 ++++- 3 files changed, 37 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Add missing EPQ recheck for TID Range Scan @ 2025-09-17 00:20 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: David Rowley @ 2025-09-17 00:20 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer matches the clause of the scan. This isn't desired behavior, and isn't consistent with what would happen if the chosen plan had used an Index or Seq Scan, and that could lead to hard to predict behavior for scans that contain TID quals and other quals as the planner has freedom to choose TID Range or some other non-TID scan method for such queries, and the chosen plan could change at any moment. Here we fix this by properly implementing the recheck function for TID Range Scans. Backpatch to 14, where TID Range Scans were added Reported-by: Sophie Alpert <pg@sophiebits.com> Author: Sophie Alpert <pg@sophiebits.com> Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/4a6268ff-3340-453a-9bf5-c98d51a6f729@app.fastmail.com Backpatch-through: 14 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0fb06e8933312e67398af9728a8eb98cafe9e742 Modified Files -------------- src/backend/executor/nodeTidrangescan.c | 10 ++++++++++ src/test/isolation/expected/eval-plan-qual.out | 23 +++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 5 ++++- 3 files changed, 37 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Add missing EPQ recheck for TID Range Scan @ 2025-09-17 00:21 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: David Rowley @ 2025-09-17 00:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer matches the clause of the scan. This isn't desired behavior, and isn't consistent with what would happen if the chosen plan had used an Index or Seq Scan, and that could lead to hard to predict behavior for scans that contain TID quals and other quals as the planner has freedom to choose TID Range or some other non-TID scan method for such queries, and the chosen plan could change at any moment. Here we fix this by properly implementing the recheck function for TID Range Scans. Backpatch to 14, where TID Range Scans were added Reported-by: Sophie Alpert <pg@sophiebits.com> Author: Sophie Alpert <pg@sophiebits.com> Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/4a6268ff-3340-453a-9bf5-c98d51a6f729@app.fastmail.com Backpatch-through: 14 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ba0203880a8f2f8ae397f176f86ed1339939479c Modified Files -------------- src/backend/executor/nodeTidrangescan.c | 10 ++++++++++ src/test/isolation/expected/eval-plan-qual.out | 23 +++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 5 ++++- 3 files changed, 37 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Add missing EPQ recheck for TID Range Scan @ 2025-09-17 00:21 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: David Rowley @ 2025-09-17 00:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer matches the clause of the scan. This isn't desired behavior, and isn't consistent with what would happen if the chosen plan had used an Index or Seq Scan, and that could lead to hard to predict behavior for scans that contain TID quals and other quals as the planner has freedom to choose TID Range or some other non-TID scan method for such queries, and the chosen plan could change at any moment. Here we fix this by properly implementing the recheck function for TID Range Scans. Backpatch to 14, where TID Range Scans were added Reported-by: Sophie Alpert <pg@sophiebits.com> Author: Sophie Alpert <pg@sophiebits.com> Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/4a6268ff-3340-453a-9bf5-c98d51a6f729@app.fastmail.com Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f00ad440a5b6ce430dda31b03788e4d4b6659f60 Modified Files -------------- src/backend/executor/nodeTidrangescan.c | 10 ++++++++++ src/test/isolation/expected/eval-plan-qual.out | 23 +++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 5 ++++- 3 files changed, 37 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Add missing EPQ recheck for TID Range Scan @ 2025-09-17 00:21 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 6+ messages in thread From: David Rowley @ 2025-09-17 00:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Range Scan The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual still passed after following update chains. This could result in tuples being updated or deleted by plans using TID Range Scans where the ctid of the new (updated) tuple no longer matches the clause of the scan. This isn't desired behavior, and isn't consistent with what would happen if the chosen plan had used an Index or Seq Scan, and that could lead to hard to predict behavior for scans that contain TID quals and other quals as the planner has freedom to choose TID Range or some other non-TID scan method for such queries, and the chosen plan could change at any moment. Here we fix this by properly implementing the recheck function for TID Range Scans. Backpatch to 14, where TID Range Scans were added Reported-by: Sophie Alpert <pg@sophiebits.com> Author: Sophie Alpert <pg@sophiebits.com> Author: David Rowley <dgrowleyml@gmail.com> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/4a6268ff-3340-453a-9bf5-c98d51a6f729@app.fastmail.com Backpatch-through: 14 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f78a69034740687669c72f15382a113ee4c482db Modified Files -------------- src/backend/executor/nodeTidrangescan.c | 10 ++++++++++ src/test/isolation/expected/eval-plan-qual.out | 23 +++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 5 ++++- 3 files changed, 37 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2025-09-17 00:21 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-09-17 00:19 pgsql: Add missing EPQ recheck for TID Range Scan David Rowley <drowley@postgresql.org> 2025-09-17 00:20 pgsql: Add missing EPQ recheck for TID Range Scan David Rowley <drowley@postgresql.org> 2025-09-17 00:20 pgsql: Add missing EPQ recheck for TID Range Scan David Rowley <drowley@postgresql.org> 2025-09-17 00:21 pgsql: Add missing EPQ recheck for TID Range Scan David Rowley <drowley@postgresql.org> 2025-09-17 00:21 pgsql: Add missing EPQ recheck for TID Range Scan David Rowley <drowley@postgresql.org> 2025-09-17 00:21 pgsql: Add missing EPQ recheck for TID Range Scan David Rowley <drowley@postgresql.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox