Michael Paquier c145f321b6 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
2024-07-19 10:21:01 +09:00
..
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-05-13 07:55:58 +12:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-06-20 11:10:26 +02:00
2024-01-18 09:35:12 +01:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00
2024-01-03 20:49:05 -05:00

The PostgreSQL contrib tree
---------------------------

This subtree contains porting tools, analysis utilities, and plug-in
features that are not part of the core PostgreSQL system, mainly
because they address a limited audience or are too experimental to be
part of the main source tree.  This does not preclude their
usefulness.

User documentation for each module appears in the main SGML
documentation.

When building from the source distribution, these modules are not
built automatically, unless you build the "world" target.  You can
also build and install them all by running "make all" and "make
install" in this directory; or to build and install just one selected
module, do the same in that module's subdirectory.

Some directories supply new user-defined functions, operators, or
types.  To make use of one of these modules, after you have installed
the code you need to register the new SQL objects in the database
system by executing a CREATE EXTENSION command.  In a fresh database,
you can simply do

    CREATE EXTENSION module_name;

See the PostgreSQL documentation for more information about this
procedure.