aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2022-03-04 14:49:37 +0100
committerPeter Eisentraut <peter@eisentraut.org>2022-03-04 14:50:22 +0100
commit791b1b71da35d9d4264f72a87e4078b85a2fcfb4 (patch)
tree016287b8c51ff0d9d591bceed27f7b223d46a8d0 /src/backend/executor
parentd816f366bc427cacba29c1e4b1696afa620e73a7 (diff)
downloadpostgresql-791b1b71da35d9d4264f72a87e4078b85a2fcfb4.tar.gz
postgresql-791b1b71da35d9d4264f72a87e4078b85a2fcfb4.zip
Parse/analyze function renaming
There are three parallel ways to call parse/analyze: with fixed parameters, with variable parameters, and by supplying your own parser callback. Some of the involved functions were confusingly named and made this API structure more confusing. This patch renames some functions to make this clearer: parse_analyze() -> parse_analyze_fixedparams() pg_analyze_and_rewrite() -> pg_analyze_and_rewrite_fixedparams() (Otherwise one might think this variant doesn't accept parameters, but in fact all three ways accept parameters.) pg_analyze_and_rewrite_params() -> pg_analyze_and_rewrite_withcb() (Before, and also when considering pg_analyze_and_rewrite(), one might think this is the only way to pass parameters. Moreover, the parser callback doesn't necessarily need to parse only parameters, it's just one of the things it could do.) parse_fixed_parameters() -> setup_parse_fixed_parameters() parse_variable_parameters() -> setup_parse_variable_parameters() (These functions don't actually do any parsing, they just set up callbacks to use during parsing later.) This patch also adds some const decorations to the fixed-parameters API, so the distinction from the variable-parameters API is more clear. Reviewed-by: Nathan Bossart <bossartn@amazon.com> Discussion: https://www.postgresql.org/message-id/flat/c67ce276-52b4-0239-dc0e-39875bf81840@enterprisedb.com
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/functions.c2
-rw-r--r--src/backend/executor/spi.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 29a68879eed..f9460ae506c 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -718,7 +718,7 @@ init_sql_fcache(FunctionCallInfo fcinfo, Oid collation, bool lazyEvalOK)
RawStmt *parsetree = lfirst_node(RawStmt, lc);
List *queryTree_sublist;
- queryTree_sublist = pg_analyze_and_rewrite_params(parsetree,
+ queryTree_sublist = pg_analyze_and_rewrite_withcb(parsetree,
fcache->src,
(ParserSetupHook) sql_fn_parser_setup,
fcache->pinfo,
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 5b353cb93a7..a82e9866670 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -2258,7 +2258,7 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
if (plan->parserSetup != NULL)
{
Assert(plan->nargs == 0);
- stmt_list = pg_analyze_and_rewrite_params(parsetree,
+ stmt_list = pg_analyze_and_rewrite_withcb(parsetree,
src,
plan->parserSetup,
plan->parserSetupArg,
@@ -2266,7 +2266,7 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
}
else
{
- stmt_list = pg_analyze_and_rewrite(parsetree,
+ stmt_list = pg_analyze_and_rewrite_fixedparams(parsetree,
src,
plan->argtypes,
plan->nargs,
@@ -2495,7 +2495,7 @@ _SPI_execute_plan(SPIPlanPtr plan, const SPIExecuteOptions *options,
else if (plan->parserSetup != NULL)
{
Assert(plan->nargs == 0);
- stmt_list = pg_analyze_and_rewrite_params(parsetree,
+ stmt_list = pg_analyze_and_rewrite_withcb(parsetree,
src,
plan->parserSetup,
plan->parserSetupArg,
@@ -2503,7 +2503,7 @@ _SPI_execute_plan(SPIPlanPtr plan, const SPIExecuteOptions *options,
}
else
{
- stmt_list = pg_analyze_and_rewrite(parsetree,
+ stmt_list = pg_analyze_and_rewrite_fixedparams(parsetree,
src,
plan->argtypes,
plan->nargs,