git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6985592)
Make constant-folding produce sane output for COALESCE(NULL,NULL),
2005年4月10日 20:57:32 +0000 (20:57 +0000)
2005年4月10日 20:57:32 +0000 (20:57 +0000)
that is a plain NULL and not a COALESCE with no inputs. Fixes crash
reported by Michael Williamson.


diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index 24d74523c3713532d015f9d0f9e78a69f7d475c7..926162d469cb6f6d2461c1c11fa1a3c6fcc03057 100644 (file)
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.193 2005年04月06日 16:34:06 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.194 2005年04月10日 20:57:32 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -1788,6 +1788,10 @@ eval_const_expressions_mutator(Node *node,
newargs = lappend(newargs, e);
}
+ /* If all the arguments were constant null, the result is just null */
+ if (newargs == NIL)
+ return (Node *) makeNullConst(coalesceexpr->coalescetype);
+
newcoalesce = makeNode(CoalesceExpr);
newcoalesce->coalescetype = coalesceexpr->coalescetype;
newcoalesce->args = newargs;
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /