From: Tom Lane Date: Thu, 29 Apr 1999 00:20:27 +0000 (+0000) Subject: Several routines in setrefs.c would crash on array refs X-Git-Tag: REL6_5~338 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=970583ab4f9818bc79ef7042eaaa791db8e92057;p=postgresql Several routines in setrefs.c would crash on array refs due to lack of check for recursing into a null subexpression. --- diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c index 3584cda153..b7b8d89c5a 100644 --- a/src/backend/optimizer/plan/setrefs.c +++ b/src/backend/optimizer/plan/setrefs.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.42 1999/04/26 00:37:46 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.43 1999/04/29 00:20:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -747,6 +747,9 @@ replace_agg_clause(Node *clause, List *subplanTargetList) List *t; List *agg_list = NIL; + if (clause == NULL) + return NIL; + if (IsA(clause, Var)) { TargetEntry *subplanVar; @@ -864,6 +867,9 @@ del_agg_clause(Node *clause) { List *t; + if (clause == NULL) + return clause; + if (IsA(clause, Var)) return clause; else if (is_funcclause(clause)) @@ -942,6 +948,9 @@ check_having_qual_for_vars(Node *clause, List *targetlist_so_far) { List *t; + if (clause == NULL) + return targetlist_so_far; + if (IsA(clause, Var)) { RelOptInfo tmp_rel; @@ -1035,6 +1044,9 @@ check_having_for_ungrouped_vars(Node *clause, List *groupClause) { List *t; + if (clause == NULL) + return; + if (IsA(clause, Var)) { /* Ignore vars elsewhere in the having clause, since the