pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Add missing EPQ recheck for TID Scan 7+ messages / 1 participants [nested] [flat]
* pgsql: Add missing EPQ recheck for TID Scan @ 2025-09-16 23:49 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2025-09-16 23:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID 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 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 or some other 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 Scans. Backpatch to 13, oldest supported version 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: 13 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/dee21ea6d6178f1acd5044fd94e3dc4542e2656b Modified Files -------------- src/backend/executor/nodeTidscan.c | 19 +++++-- src/test/isolation/expected/eval-plan-qual.out | 71 ++++++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 11 ++++ 3 files changed, 97 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add missing EPQ recheck for TID Scan @ 2025-09-16 23:49 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2025-09-16 23:49 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID 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 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 or some other 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 Scans. Backpatch to 13, oldest supported version 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: 13 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/bae6c74ba4e4e4fdbb45e45569a5b53f27590b1c Modified Files -------------- src/backend/executor/nodeTidscan.c | 19 +++++-- src/test/isolation/expected/eval-plan-qual.out | 71 ++++++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 11 ++++ 3 files changed, 97 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add missing EPQ recheck for TID Scan @ 2025-09-16 23:50 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2025-09-16 23:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID 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 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 or some other 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 Scans. Backpatch to 13, oldest supported version 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: 13 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3d939a9b1c72ac34df69aa7540f212b9a79aadc5 Modified Files -------------- src/backend/executor/nodeTidscan.c | 19 +++++-- src/test/isolation/expected/eval-plan-qual.out | 71 ++++++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 11 ++++ 3 files changed, 97 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add missing EPQ recheck for TID Scan @ 2025-09-16 23:50 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2025-09-16 23:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID 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 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 or some other 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 Scans. Backpatch to 13, oldest supported version 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: 13 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d6539f88b7c5bd2889dfdadc922c740bf5d3e0e4 Modified Files -------------- src/backend/executor/nodeTidscan.c | 19 +++++-- src/test/isolation/expected/eval-plan-qual.out | 71 ++++++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 11 ++++ 3 files changed, 97 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add missing EPQ recheck for TID Scan @ 2025-09-16 23:50 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2025-09-16 23:50 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID 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 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 or some other 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 Scans. Backpatch to 13, oldest supported version 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: 13 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/005770203889a0df250d584aa89f09ea4ee9a136 Modified Files -------------- src/backend/executor/nodeTidscan.c | 19 +++++-- src/test/isolation/expected/eval-plan-qual.out | 71 ++++++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 11 ++++ 3 files changed, 97 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add missing EPQ recheck for TID Scan @ 2025-09-16 23:51 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2025-09-16 23:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID 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 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 or some other 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 Scans. Backpatch to 13, oldest supported version 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: 13 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2eb7ea97d8af4f4a8c65ff9f95fcbe4e4ab8e7a8 Modified Files -------------- src/backend/executor/nodeTidscan.c | 19 +++++-- src/test/isolation/expected/eval-plan-qual.out | 71 ++++++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 11 ++++ 3 files changed, 97 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
* pgsql: Add missing EPQ recheck for TID Scan @ 2025-09-16 23:51 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 7+ messages in thread From: David Rowley @ 2025-09-16 23:51 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Add missing EPQ recheck for TID Scan The EvalPlanQual recheck for TID 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 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 or some other 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 Scans. Backpatch to 13, oldest supported version 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: 13 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/940f3cd5df57df41bb3d71f7f91fe0c713699e4d Modified Files -------------- src/backend/executor/nodeTidscan.c | 19 +++++-- src/test/isolation/expected/eval-plan-qual.out | 71 ++++++++++++++++++++++++++ src/test/isolation/specs/eval-plan-qual.spec | 11 ++++ 3 files changed, 97 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2025-09-16 23:51 UTC | newest] Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-09-16 23:49 pgsql: Add missing EPQ recheck for TID Scan David Rowley <drowley@postgresql.org> 2025-09-16 23:49 pgsql: Add missing EPQ recheck for TID Scan David Rowley <drowley@postgresql.org> 2025-09-16 23:50 pgsql: Add missing EPQ recheck for TID Scan David Rowley <drowley@postgresql.org> 2025-09-16 23:50 pgsql: Add missing EPQ recheck for TID Scan David Rowley <drowley@postgresql.org> 2025-09-16 23:50 pgsql: Add missing EPQ recheck for TID Scan David Rowley <drowley@postgresql.org> 2025-09-16 23:51 pgsql: Add missing EPQ recheck for TID Scan David Rowley <drowley@postgresql.org> 2025-09-16 23:51 pgsql: Add missing EPQ recheck for TID 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