Skip to content

Commit 77ee808

Browse files
committed
bugfix: check that variable is the partitioning key
1 parent d874c6b commit 77ee808

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pg_pathman.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,11 +1447,9 @@ handle_arrexpr(const ScalarArrayOpExpr *expr, WalkerContext *context)
14471447
result->orig = (const Node *)expr;
14481448
result->args = NIL;
14491449

1450-
if (varnode == NULL || !IsA(varnode, Var))
1451-
{
1452-
result->rangeset = list_make1_irange(make_irange(0, prel->children_count - 1, true));
1453-
return result;
1454-
}
1450+
/* If variable is not the partition key then skip it */
1451+
if (!varnode || !IsA(varnode, Var) || ((Var *) varnode)->varattno != prel->attnum)
1452+
goto handle_arrexpr_return;
14551453

14561454
if (arraynode && IsA(arraynode, Const) &&
14571455
!((Const *) arraynode)->constisnull)
@@ -1491,6 +1489,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr, WalkerContext *context)
14911489
return result;
14921490
}
14931491

1492+
handle_arrexpr_return:
14941493
result->rangeset = list_make1_irange(make_irange(0, prel->children_count - 1, true));
14951494
return result;
14961495
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy