diff --git a/src/backend/partitioning/partprune.c b/src/backend/partitioning/partprune.c index 6b635e8ad1..2b582a0e72 100644 --- a/src/backend/partitioning/partprune.c +++ b/src/backend/partitioning/partprune.c @@ -1810,6 +1810,13 @@ match_clause_to_partition_key(GeneratePruningStepsContext *context, { PartClauseInfo *partclause; + /* + * Boolean exprs in the form of IS NOT false, IS NOT true are only supported + * for LIST partitioned tables. + */ + if (noteq && part_scheme->strategy != PARTITION_STRATEGY_LIST) + return PARTCLAUSE_UNSUPPORTED; + partclause = (PartClauseInfo *) palloc(sizeof(PartClauseInfo)); partclause->keyno = partkeyidx; /* Do pruning with the Boolean equality operator. */ @@ -2757,6 +2764,15 @@ get_matching_list_bounds(PartitionPruneContext *context, /* Always include the default partition if any. */ result->scan_default = partition_bound_has_default(boundinfo); + /* + * XXX this line will cause is to match to the NULL partition for + * non-boolean cases too. That's a problem as int4 <> const will + * not match NULLs, so we'll scan the NULL partition needlessly for + * those cases. We'd need a way to check if we're handling bools + * here. + */ + result->scan_null = partition_bound_accepts_nulls(boundinfo); + return result; }