mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Add pg_analyze_and_rewrite_varparams()
This new function extracts common code from PrepareQuery() and exec_parse_message(). It is then exactly analogous to the existing pg_analyze_and_rewrite_fixedparams() and pg_analyze_and_rewrite_withcb(). To unify these two code paths, this makes PrepareQuery() now subject to log_parser_stats. Also, both paths now invoke TRACE_POSTGRESQL_QUERY_REWRITE_START(). PrepareQuery() no longer checks whether a utility statement was specified. The grammar doesn't allow that anyway, and exec_parse_message() supports it, so restricting it doesn't seem necessary. This also adds QueryEnvironment support to the *varparams functions, for consistency with its cousins, even though it is not used right now. Reviewed-by: Nathan Bossart <bossartn@amazon.com> Discussion: https://www.postgresql.org/message-id/flat/c67ce276-52b4-0239-dc0e-39875bf81840@enterprisedb.com
This commit is contained in:
@ -148,7 +148,8 @@ parse_analyze_fixedparams(RawStmt *parseTree, const char *sourceText,
|
||||
*/
|
||||
Query *
|
||||
parse_analyze_varparams(RawStmt *parseTree, const char *sourceText,
|
||||
Oid **paramTypes, int *numParams)
|
||||
Oid **paramTypes, int *numParams,
|
||||
QueryEnvironment *queryEnv)
|
||||
{
|
||||
ParseState *pstate = make_parsestate(NULL);
|
||||
Query *query;
|
||||
@ -160,6 +161,8 @@ parse_analyze_varparams(RawStmt *parseTree, const char *sourceText,
|
||||
|
||||
setup_parse_variable_parameters(pstate, paramTypes, numParams);
|
||||
|
||||
pstate->p_queryEnv = queryEnv;
|
||||
|
||||
query = transformTopLevelStmt(pstate, parseTree);
|
||||
|
||||
/* make sure all is well with parameter types */
|
||||
|
Reference in New Issue
Block a user