Re: Set query_id for query contained in utility statement

Поиск
Список
Период
Сортировка
От Anthonin Bonnefoy
Тема Re: Set query_id for query contained in utility statement
Дата
Msg-id CAO6_XqoXFCRMviF5QOgqnmQbgbUOKdWmPo9uNob_hzP3d+-GjQ@mail.gmail.com
обсуждение исходный текст
Ответ на Set query_id for query contained in utility statement  (Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>)
Ответы Re: Set query_id for query contained in utility statement
Список pgsql-hackers
I've realised my initial approach was wrong, calling the post parse
for all nested queries in analyze.c prevents extension like pgss to
correctly track the query's nesting level.

I've changed the approach to replicate what's done in ExplainQuery to
both CreateTableAs and DeclareCursor: Jumble the query contained by
the utility statement and call the post parse hook before it is
planned or executed. Additionally, explain's nested query can itself
be a CreateTableAs or DeclareCursor which also needs to be jumbled.
The issue is visible when explaining a CreateTableAs or DeclareCursor
Query, the queryId is missing despite the verbose.

EXPLAIN (verbose) create table test_t as select 1;
                QUERY PLAN
------------------------------------------
 Result  (cost=0.00..0.01 rows=1 width=4)
   Output: 1

Post patch, the query id is correctly displayed.

EXPLAIN (verbose) create table test_t as select 1;
                QUERY PLAN
------------------------------------------
 Result  (cost=0.00..0.01 rows=1 width=4)
   Output: 1
 Query Identifier: 2800308901962295548

Regards,
Anthonin Bonnefoy

Вложения

В списке pgsql-hackers по дате отправления: