pgsql: Fix partition pruning with IS [NOT] NULL clauses

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix partition pruning with IS [NOT] NULL clauses
Date: 2018-07-16 22:48:04
Message-ID: E1ffCHk-0008U5-2p@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix partition pruning with IS [NOT] NULL clauses

The original code was unable to prune partitions that could not possibly
contain NULL values, when the query specified less than all columns in a
multicolumn partition key. Reorder the if-tests so that it is, and add
more commentary and regression tests.

Reported-by: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Co-authored-by: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Co-authored-by: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Co-authored-by: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Reviewed-by: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Reviewed-by: amul sul <sulamul(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAFjFpRc7qjLUfXLVBBC_HAnx644sjTYM=qVoT3TJ840HPbsTXw@mail.gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fb2b61a21e141843697de7982c9f6485effcd915

Modified Files
--------------
src/backend/partitioning/partprune.c | 78 ++++++++++++++-------------
src/test/regress/expected/partition_prune.out | 41 ++++++++++++++
src/test/regress/sql/partition_prune.sql | 7 +++
3 files changed, 90 insertions(+), 36 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2018-07-17 00:02:58 pgsql: Fix ALTER TABLE...SET STATS error message for included columns
Previous Message Robert Haas 2018-07-16 21:59:38 pgsql: Add subtransaction handling for table synchronization workers.