mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 06:41:24 +03:00
Fix performance issue in exprTypmod(): for a COALESCE expression, it
recursed twice on its first argument, leading to exponential time spent on a deep nest of COALESCEs ... such as a deeply nested FULL JOIN would produce. Per report from Matt Carter.
This commit is contained in:
parent
48fabd257f
commit
e03c5e2d5a
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.163.2.3 2005/05/25 02:13:48 ishii Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.163.2.4 2005/11/18 23:08:43 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -1425,8 +1425,12 @@ exprTypmod(Node *expr)
|
|||||||
int32 typmod;
|
int32 typmod;
|
||||||
List *arg;
|
List *arg;
|
||||||
|
|
||||||
|
if (exprType((Node *) lfirst(cexpr->args)) != coalescetype)
|
||||||
|
return -1;
|
||||||
typmod = exprTypmod((Node *) lfirst(cexpr->args));
|
typmod = exprTypmod((Node *) lfirst(cexpr->args));
|
||||||
foreach(arg, cexpr->args)
|
if (typmod < 0)
|
||||||
|
return -1; /* no point in trying harder */
|
||||||
|
foreach(arg, lnext(cexpr->args))
|
||||||
{
|
{
|
||||||
Node *e = (Node *) lfirst(arg);
|
Node *e = (Node *) lfirst(arg);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user