From: | David Rowley <drowley(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix runtime partition pruning for HASH partitioned tables |
Date: | 2023-10-12 12:14:39 |
Message-ID: | E1qquaN-000AeB-6U@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
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_13_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/890a73ba3ac0ea9ec2ad6a828ffe03ca12b11564
Modified Files
--------------
src/backend/executor/execPartition.c | 29 ++++++++++++++++-----------
src/test/regress/expected/partition_prune.out | 22 +++++++++++++++++++-
src/test/regress/sql/partition_prune.sql | 21 +++++++++++++++++--
3 files changed, 57 insertions(+), 15 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2023-10-12 12:15:05 | pgsql: Fix runtime partition pruning for HASH partitioned tables |
Previous Message | David Rowley | 2023-10-12 12:14:14 | pgsql: Fix runtime partition pruning for HASH partitioned tables |