Re: Set query_id for query contained in utility statement
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-08-27T09:12:00Z
Lists: pgsql-hackers
On Mon, Aug 26, 2024 at 4:55 PM Anthonin Bonnefoy
<anthonin.bonnefoy@datadoghq.com> wrote:
>
/* Evaluate parameters, if any */
if (entry->plansource->num_params)
{
- ParseState *pstate;
-
- pstate = make_parsestate(NULL);
- pstate->p_sourcetext = queryString;
you deleted the above these lines, but passed (ParseState *pstate) in
ExplainExecuteQuery
how do you make sure ExplainExecuteQuery passed (ParseState *pstate)
the p_next_resno is 1 and p_resolve_unknowns is true.
maybe we can add some Asserts like in ExplainExecuteQuery
/* Evaluate parameters, if any */
if (entry->plansource->num_params)
{
Assert(pstate->p_next_resno == 1);
Assert(pstate->p_resolve_unknowns == 1);
}
also it's ok to use passed (ParseState *pstate) for
{
estate = CreateExecutorState();
estate->es_param_list_info = params;
paramLI = EvaluateParams(pstate, entry, execstmt->params, estate);
}
?
I really don't know.
some of the change is refactoring, maybe you can put it into a separate patch.
Commits
-
Set query ID for inner queries of CREATE TABLE AS and DECLARE
- 6b652e6ce85a 18.0 landed
-
Track more precisely query locations for nested statements
- 499edb09741b 18.0 landed
-
pg_stat_statements: Add tests for nested queries with level tracking
- 45e0ba30fc40 18.0 landed
-
Fix race condition in COMMIT PREPARED causing orphaned 2PC files
- cf4401fe6cf5 18.0 cited