pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Langote <amitlan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix EPQ crash from missing partition pruning state in EState
Date: Fri, 19 Sep 2025 02:40:53 +0000
Message-ID: <E1uzR3N-001QKF-0G@gemulon.postgresql.org> (raw)

Fix EPQ crash from missing partition pruning state in EState

Commit bb3ec16e14 moved partition pruning metadata into PlannedStmt.
At executor startup this metadata is used to initialize the EState
fields es_part_prune_infos, es_part_prune_states, and
es_part_prune_results.  EvalPlanQualStart() failed to copy those
fields into the child EState, causing NULL dereference when Append
ran partition pruning during a recheck. This can occur with DELETE
or UPDATE on partitioned tables that use runtime pruning, e.g. with
generic plans.

Fix by copying all partition pruning state into the EPQ estate.

Add an isolation test that reproduces the crash with concurrent
UPDATE and DELETE on a partitioned table, where the DELETE session
hits the crash during its EPQ recheck after the UPDATE commits.

Bug: #19056
Reported-by: Fei Changhong <feichanghong@qq.com>
Diagnozed-by: Fei Changhong <feichanghong@qq.com>
Author: David Rowley <dgrowleyml@gmail.com>
Co-authored-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/19056-a677cef9b54d76a0%40postgresql.org

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9a82a64edcd8615cf16eae64bf1572d4156cb912

Modified Files
--------------
src/backend/executor/execMain.c                | 9 +++++++++
src/test/isolation/expected/eval-plan-qual.out | 9 +++++++++
src/test/isolation/specs/eval-plan-qual.spec   | 8 ++++++++
3 files changed, 26 insertions(+)



view thread (5+ messages)  latest in thread

Message-ID: <E1uzR3N-001QKF-0G@gemulon.postgresql.org>
Permalink:  ../E1uzR3N-001QKF-0G@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uzR3N-001QKF-0G@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: amitlan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix EPQ crash from missing partition pruning state in EState
  In-Reply-To: <E1uzR3N-001QKF-0G@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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