pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix run-time partition pruning code to handle NULL values proper
Date: Mon, 11 Jun 2018 16:08:29 +0000
Message-ID: <E1fSPMr-0006yb-Ps@gemulon.postgresql.org> (raw)

Fix run-time partition pruning code to handle NULL values properly.

The previous coding just ignored pruning constraints that compare a
partition key to a null-valued expression.  This is silly, since really
what we can do there is conclude that all partitions are rejected: the
pruning operator is known strict so the comparison must always fail.

This also fixes the logic to not ignore constisnull for a Const comparison
value.  That's probably an unreachable case, since the planner would
normally have simplified away a strict operator with a constant-null input.
But this code has no business assuming that.

David Rowley, per a gripe from me

Discussion: https://postgr.es/m/26279.1528670981@sss.pgh.pa.us

Branch
------
master

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

Modified Files
--------------
src/backend/partitioning/partprune.c          | 48 +++++++++++++++++++--------
src/test/regress/expected/partition_prune.out | 14 ++++++++
src/test/regress/sql/partition_prune.sql      |  4 +++
3 files changed, 53 insertions(+), 13 deletions(-)



Message-ID: <E1fSPMr-0006yb-Ps@gemulon.postgresql.org>
Permalink:  ../E1fSPMr-0006yb-Ps@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fSPMr-0006yb-Ps@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Fix run-time partition pruning code to handle NULL values proper
  In-Reply-To: <E1fSPMr-0006yb-Ps@gemulon.postgresql.org>
  References: <E1fSPMr-0006yb-Ps@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