mirror of https://github.com/citusdata/citus.git
Improve safety check in FindReferencedTableColumn to assert valid groupIndex
parent
cd017ee69c
commit
2b30606970
|
@ -4568,11 +4568,9 @@ FindReferencedTableColumn(Expr *columnExpression, List *parentQueryList, Query *
|
||||||
List *groupexprs = rangeTableEntry->groupexprs;
|
List *groupexprs = rangeTableEntry->groupexprs;
|
||||||
AttrNumber groupIndex = candidateColumn->varattno - 1;
|
AttrNumber groupIndex = candidateColumn->varattno - 1;
|
||||||
|
|
||||||
/* Safety check */
|
/* this must always hold unless upstream Postgres mis-constructed the RTE_GROUP */
|
||||||
if (groupIndex < 0 || groupIndex >= list_length(groupexprs))
|
Assert(groupIndex >= 0 && groupIndex < list_length(groupexprs));
|
||||||
{
|
|
||||||
return; /* malformed Var */
|
|
||||||
}
|
|
||||||
Expr *groupExpr = (Expr *) list_nth(groupexprs, groupIndex);
|
Expr *groupExpr = (Expr *) list_nth(groupexprs, groupIndex);
|
||||||
|
|
||||||
/* Recurse on the underlying expression (stay in the same query) */
|
/* Recurse on the underlying expression (stay in the same query) */
|
||||||
|
|
Loading…
Reference in New Issue