pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Propagate query IDs of utility statements in functions 3+ messages / 1 participants [nested] [flat]
* pgsql: Propagate query IDs of utility statements in functions @ 2024-07-19 01:21 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2024-07-19 01:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/c145f321b681ab6c3636849071ff30d5c6f6353c 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(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Propagate query IDs of utility statements in functions @ 2024-07-19 01:21 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2024-07-19 01:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/38e271d3c2e8c3bfa4d57fd81c3e47b40f1f5eb3 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(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Propagate query IDs of utility statements in functions @ 2024-07-19 01:21 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 3+ messages in thread From: Michael Paquier @ 2024-07-19 01:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(+) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2024-07-19 01:21 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2024-07-19 01:21 pgsql: Propagate query IDs of utility statements in functions Michael Paquier <michael@paquier.xyz> 2024-07-19 01:21 pgsql: Propagate query IDs of utility statements in functions Michael Paquier <michael@paquier.xyz> 2024-07-19 01:21 pgsql: Propagate query IDs of utility statements in functions Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox