postgresql/src
David Rowley dee21ea6d6 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
2025-09-17 11:48:55 +12:00
..
backend Add missing EPQ recheck for TID Scan 2025-09-17 11:48:55 +12:00
bin Fix pg_dump COMMENT dependency for separate domain constraints. 2025-09-16 09:40:44 -07:00
common Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:40 -04:00
fe_utils meson: add and use stamp files for generated headers 2025-08-11 15:18:23 -04:00
include Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
interfaces Move pg_int64 back to postgres_ext.h 2025-09-16 10:48:56 +02:00
makefiles Remove traces of support for Sun Studio compiler 2025-09-12 07:39:05 +02:00
pl Provide more-specific error details/hints for function lookup failures. 2025-09-16 12:17:02 -04:00
port Use strchr instead of strstr for single-char lookups 2025-07-23 12:02:55 +12:00
template Remove traces of support for Sun Studio compiler 2025-09-12 07:39:05 +02:00
test Add missing EPQ recheck for TID Scan 2025-09-17 11:48:55 +12:00
timezone Generate GUC tables from .dat file 2025-09-03 09:45:17 +02:00
tools Change fmgr.h typedefs to use original names 2025-09-15 11:04:10 +02:00
tutorial Doc: simplify the tutorial's window-function examples. 2025-01-21 14:43:21 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Remove traces of support for Sun Studio compiler 2025-09-12 07:39:05 +02:00
Makefile.shlib Use exported symbols list on macOS for loadable modules as well 2025-06-10 07:04:43 +02:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00