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

Commit4e20511

Browse files
committed
Fix estimate_expression_value to constant-fold SQLValueFunction nodes.
Oversight in my commit0bb51aa. Noted while poking at a recentbug report --- HEAD's estimates for a query using CURRENT_DATEwere unexpectedly much worse than 9.6's.
1 parenteb68141 commit4e20511

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3346,6 +3346,23 @@ eval_const_expressions_mutator(Node *node,
33463346
newcoalesce->location=coalesceexpr->location;
33473347
return (Node*)newcoalesce;
33483348
}
3349+
caseT_SQLValueFunction:
3350+
{
3351+
/*
3352+
* All variants of SQLValueFunction are stable, so if we are
3353+
* estimating the expression's value, we should evaluate the
3354+
* current function value. Otherwise just copy.
3355+
*/
3356+
SQLValueFunction*svf= (SQLValueFunction*)node;
3357+
3358+
if (context->estimate)
3359+
return (Node*)evaluate_expr((Expr*)svf,
3360+
svf->type,
3361+
svf->typmod,
3362+
InvalidOid);
3363+
else
3364+
returncopyObject((Node*)svf);
3365+
}
33493366
caseT_FieldSelect:
33503367
{
33513368
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp