pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix runtime partition pruning for HASH partitioned tables
Date: Thu, 12 Oct 2023 12:15:30 +0000
Message-ID: <E1qqubB-000Afs-T6@gemulon.postgresql.org> (raw)

Fix runtime partition pruning for HASH partitioned tables

This could only affect HASH partitioned tables with at least 2 partition
key columns.

If partition pruning was delayed until execution and the query contained
an IS NULL qual on one of the partitioned keys, and some subsequent
partitioned key was being compared to a non-Const, then this could result
in a crash due to the incorrect keyno being used to calculate the
stateidx for the expression evaluation code.

Here we fix this by properly skipping partitioned keys which have a
nullkey set.  Effectively, this must be the same as what's going on
inside perform_pruning_base_step().

Sergei Glukhov also provided a patch, but that's not what's being used
here.

Reported-by: Sergei Glukhov
Reviewed-by: tender wang, Sergei Glukhov
Discussion: https://postgr.es/m/d05b26fa-af54-27e1-f693-6c31590802fa@postgrespro.ru
Backpatch-through: 11, where runtime partition pruning was added.

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2759924f33a6b7021f68dda05bb34b10bb4579e2

Modified Files
--------------
src/backend/executor/execPartition.c | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)



view thread (7+ messages)

Message-ID: <E1qqubB-000Afs-T6@gemulon.postgresql.org>
Permalink:  ../E1qqubB-000Afs-T6@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qqubB-000Afs-T6@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: drowley@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix runtime partition pruning for HASH partitioned tables
  In-Reply-To: <E1qqubB-000Afs-T6@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