8741e48e5made EvalPlanQualStart() borrow the parent EState's es_part_prune_states. However, the ExprContext in each PartitionPruneState belongs to the parent EState, so exec pruning during an EPQ recheck used the parent's PARAM_EXEC values, i.e. those from the old row version. This could prune away the partition the recheck needed, causing the row to be silently skipped, e.g. with a correlated subquery on a partitioned table in the WHERE clause of an UPDATE. Here we fix this by giving the EPQ EState its own PartitionPruneStates, while still borrowing the parent's es_part_prune_results so that the same subplans are initialized. As the states are no longer shared, the "initialized" field added by1b5dd3a24is no longer needed, so remove it. This also undoes the ABI break that field caused in 18. Backpatch to 18, where8741e48e5and1b5dd3a24were backpatched. Author: Zsolt Parragi <zsolt.parragi@percona.com> Reviewed-by: David Rowley <dgrowleyml@gmail.com> Discussion: https://postgr.es/m/CAN4CZFPZ6qKnv6FPmq1RQZ49cHALCwLBu_NJdqUrkZNg0z81JQ%40mail.gmail.com Backpatch-through: 18
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/19/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/19/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.