mirror of
https://github.com/postgres/postgres.git
synced 2025-05-18 17:41:14 +03:00
Make constant-folding produce sane output for COALESCE(NULL,NULL),
that is a plain NULL and not a COALESCE with no inputs. Fixes crash reported by Michael Williamson.
This commit is contained in:
parent
5c5c797cb2
commit
29028762a9
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.154.2.2 2004/01/28 00:05:25 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.154.2.3 2005/04/10 20:58:03 tgl Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -1553,6 +1553,10 @@ eval_const_expressions_mutator(Node *node, List *active_fns)
|
|||||||
FastAppend(&newargs, e);
|
FastAppend(&newargs, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If all the arguments were constant null, the result is just null */
|
||||||
|
if (FastListValue(&newargs) == NIL)
|
||||||
|
return (Node *) makeNullConst(coalesceexpr->coalescetype);
|
||||||
|
|
||||||
newcoalesce = makeNode(CoalesceExpr);
|
newcoalesce = makeNode(CoalesceExpr);
|
||||||
newcoalesce->coalescetype = coalesceexpr->coalescetype;
|
newcoalesce->coalescetype = coalesceexpr->coalescetype;
|
||||||
newcoalesce->args = FastListValue(&newargs);
|
newcoalesce->args = FastListValue(&newargs);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user