Commit 970583ab authored by Tom Lane's avatar Tom Lane

Several routines in setrefs.c would crash on array refs

due to lack of check for recursing into a null subexpression.
parent 89cf9303
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -747,6 +747,9 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
List *t; List *t;
List *agg_list = NIL; List *agg_list = NIL;
if (clause == NULL)
return NIL;
if (IsA(clause, Var)) if (IsA(clause, Var))
{ {
TargetEntry *subplanVar; TargetEntry *subplanVar;
...@@ -864,6 +867,9 @@ del_agg_clause(Node *clause) ...@@ -864,6 +867,9 @@ del_agg_clause(Node *clause)
{ {
List *t; List *t;
if (clause == NULL)
return clause;
if (IsA(clause, Var)) if (IsA(clause, Var))
return clause; return clause;
else if (is_funcclause(clause)) else if (is_funcclause(clause))
...@@ -942,6 +948,9 @@ check_having_qual_for_vars(Node *clause, List *targetlist_so_far) ...@@ -942,6 +948,9 @@ check_having_qual_for_vars(Node *clause, List *targetlist_so_far)
{ {
List *t; List *t;
if (clause == NULL)
return targetlist_so_far;
if (IsA(clause, Var)) if (IsA(clause, Var))
{ {
RelOptInfo tmp_rel; RelOptInfo tmp_rel;
...@@ -1035,6 +1044,9 @@ check_having_for_ungrouped_vars(Node *clause, List *groupClause) ...@@ -1035,6 +1044,9 @@ check_having_for_ungrouped_vars(Node *clause, List *groupClause)
{ {
List *t; List *t;
if (clause == NULL)
return;
if (IsA(clause, Var)) if (IsA(clause, Var))
{ {
/* Ignore vars elsewhere in the having clause, since the /* Ignore vars elsewhere in the having clause, since the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment