Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitacde8b3

Browse files
committed
Make constant-folding produce sane output for COALESCE(NULL,NULL),
that is a plain NULL and not a COALESCE with no inputs. Fixes crashreported by Michael Williamson.
1 parent6985592 commitacde8b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎src/backend/optimizer/util/clauses.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.193 2005/04/06 16:34:06 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.194 2005/04/10 20:57:32 tgl Exp $
1212
*
1313
* HISTORY
1414
* AUTHORDATEMAJOR EVENT
@@ -1788,6 +1788,10 @@ eval_const_expressions_mutator(Node *node,
17881788
newargs=lappend(newargs,e);
17891789
}
17901790

1791+
/* If all the arguments were constant null, the result is just null */
1792+
if (newargs==NIL)
1793+
return (Node*)makeNullConst(coalesceexpr->coalescetype);
1794+
17911795
newcoalesce=makeNode(CoalesceExpr);
17921796
newcoalesce->coalescetype=coalesceexpr->coalescetype;
17931797
newcoalesce->args=newargs;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp