Code review of get_qual_for_list.
authorRobert Haas <rhaas@postgresql.org>
Wed, 24 May 2017 20:30:47 +0000 (16:30 -0400)
committerRobert Haas <rhaas@postgresql.org>
Wed, 24 May 2017 20:45:58 +0000 (16:45 -0400)
We need not consider the case where both nulltest1 and nulltest2 are
NULL; the partition either accepts nulls or it does not.

Jeevan Ladhe.  I added an assertion.

src/backend/catalog/partition.c

index 7304f6c29ab2a71b9df7ca55e75cdbb2a44d8b7a..7f2fd58462daa4ec4fdb55d0bb02251b70bdaa9c 100644 (file)
@@ -1383,15 +1383,14 @@ get_qual_for_list(PartitionKey key, PartitionBoundSpec *spec)
 
    if (nulltest1)
        result = list_make2(nulltest1, opexpr);
-   else if (nulltest2)
+   else
    {
        Expr       *or;
 
+       Assert(nulltest2 != NULL);
        or = makeBoolExpr(OR_EXPR, list_make2(nulltest2, opexpr), -1);
        result = list_make1(or);
    }
-   else
-       result = list_make1(opexpr);
 
    return result;
 }