projects
/
users
/
bernd
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
dac1b0d
)
Make constant-folding produce sane output for COALESCE(NULL,NULL),
author
Tom Lane
<
[email protected]
>
Sun, 10 Apr 2005 20:58:03 +0000
(20:58 +0000)
committer
Tom Lane
<
[email protected]
>
Sun, 10 Apr 2005 20:58:03 +0000
(20:58 +0000)
that is a plain NULL and not a COALESCE with no inputs. Fixes crash
reported by Michael Williamson.
src/backend/optimizer/util/clauses.c
patch
|
blob
|
blame
|
history
diff --git
a/src/backend/optimizer/util/clauses.c
b/src/backend/optimizer/util/clauses.c
index ff36afc6f29763c2ac639c7a2176124d901d6b06..ccd0fe7392e2c032d7499ac3bbca09331301a308 100644
(file)
--- a/
src/backend/optimizer/util/clauses.c
+++ b/
src/backend/optimizer/util/clauses.c
@@
-1553,6
+1553,10
@@
eval_const_expressions_mutator(Node *node, List *active_fns)
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->coalescetype = coalesceexpr->coalescetype;
newcoalesce->args = FastListValue(&newargs);