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

Commit00418c6

Browse files
committed
Simplify plpgsql's check for simple expressions.
plpgsql wants to recognize expressions that it can execute directlyvia ExecEvalExpr() instead of going through the full SPI machinery.Originally the test for this consisted of recursively groveling throughthe post-planning expression tree to see if it contained only nodes thatplpgsql recognized as safe. That was a major maintenance headache, sinceit required updating plpgsql every time we added any kind of expressionnode. It was also kind of expensive, so over time we added variouspre-planning checks to try to short-circuit having to do that.Robert Haas pointed out that as of the SRF-processing changes in v10,particularly the addition of Query.hasTargetSRFs, there really isn'tany reason to make the recursive scan at all: the initial checks covereverything we really care about. We do have to make sure that thosechecks agree with what inline_function() considers, so that inliningof a function that formerly wasn't inlined can't cause an expressionconsidered simple to become non-simple.Hence, delete the recursive function exec_simple_check_node(), and tweakthose other tests to more exactly agree with inline_function(). Adjustsome comments and function naming to match.Discussion:https://postgr.es/m/CA+TgmoZGZpwdEV2FQWaVxA_qZXsQE1DAS5Fu8fwxXDNvfndiUQ@mail.gmail.com
1 parenta4619b2 commit00418c6

File tree

2 files changed

+53
-339
lines changed

2 files changed

+53
-339
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4445,6 +4445,11 @@ inline_function(Oid funcid, Oid result_type, Oid result_collid,
44454445

44464446
/*
44474447
* The single command must be a simple "SELECT expression".
4448+
*
4449+
* Note: if you change the tests involved in this, see also plpgsql's
4450+
* exec_simple_check_plan(). That generally needs to have the same idea
4451+
* of what's a "simple expression", so that inlining a function that
4452+
* previously wasn't inlined won't change plpgsql's conclusion.
44484453
*/
44494454
if (!IsA(querytree,Query)||
44504455
querytree->commandType!=CMD_SELECT||

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp