Fix run-time partition pruning code to handle NULL values properly.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/partitioning/partprune.c | modified | +35 −13 |
| src/test/regress/expected/partition_prune.out | modified | +14 −0 |
| src/test/regress/sql/partition_prune.sql | modified | +4 −0 |
Discussion
- why partition pruning doesn't work? 72 messages · 2018-06-01 → 2018-07-18