From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Propagate query IDs of utility statements in functions |
Date: | 2024-07-19 01:21:58 |
Message-ID: | E1sUcJq-000CZ7-Lo@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Propagate query IDs of utility statements in functions
For utility statements defined within a function, the query tree is
copied to a PlannedStmt as utility commands do not require planning.
However, the query ID was missing from the information passed down.
This leads to plugins relying on the query ID like pg_stat_statements to
not be able to track utility statements within function calls. Tests
are added to check this behavior, depending on pg_stat_statements.track.
This is an old bug. Now, query IDs for utilities are compiled using
their parsed trees rather than the query string since v16
(3db72ebcbe20), leading to less bloat with utilities, so backpatch down
only to this version.
Author: Anthonin Bonnefoy
Discussion: https://postgr.es/m/CAO6_XqrGp-uwBqi3vBPLuRULKkddjC7R5QZCgsFren=8E+m2Sg@mail.gmail.com
Backpatch-through: 16
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/9cd365f28f31dc8ea9d8c10ec7abd658aa29fcf5
Modified Files
--------------
.../pg_stat_statements/expected/level_tracking.out | 45 ++++++++++++++++++++++
contrib/pg_stat_statements/sql/level_tracking.sql | 22 +++++++++++
src/backend/executor/functions.c | 1 +
3 files changed, 68 insertions(+)
From | Date | Subject | |
---|---|---|---|
Next Message | Etsuro Fujita | 2024-07-19 04:24:28 | pgsql: postgres_fdw: Avoid "cursor can only scan forward" error. |
Previous Message | Tom Lane | 2024-07-18 17:49:03 | pgsql: Improve pg_ctl's message for shutdown after recovery. |