Skip to content

Commit 175b0c8

Browse files
committed
pathman: check that variable is the partitioning key (bugfix)
1 parent 7345c79 commit 175b0c8

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

contrib/pg_pathman/pg_pathman.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,11 +1340,9 @@ handle_arrexpr(const ScalarArrayOpExpr *expr, const PartRelationInfo *prel)
13401340
result->orig = (const Node *)expr;
13411341
result->args = NIL;
13421342

1343-
if (varnode == NULL || !IsA(varnode, Var))
1344-
{
1345-
result->rangeset = list_make1_irange(make_irange(0, prel->children_count - 1, true));
1346-
return result;
1347-
}
1343+
/* If variable is not the partition key then skip it */
1344+
if (!varnode || !IsA(varnode, Var) || ((Var *) varnode)->varattno != prel->attnum)
1345+
goto handle_arrexpr_return;
13481346

13491347
if (arraynode && IsA(arraynode, Const) &&
13501348
!((Const *) arraynode)->constisnull)
@@ -1384,6 +1382,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr, const PartRelationInfo *prel)
13841382
return result;
13851383
}
13861384

1385+
handle_arrexpr_return:
13871386
result->rangeset = list_make1_irange(make_irange(0, prel->children_count - 1, true));
13881387
return result;
13891388
}

0 commit comments

Comments
 (0)