postgresql/contrib
Michael Paquier e8dbdb15db Refactor tests of pg_stat_statements for planning, utility and level tracking
pg_stat_statements.sql acts as the main file for all the core tests of
the module, but things have become complicated to follow over the years
as some of the sub-scenarios tested in this file rely on assumptions
that come from completely different areas of it, like a GUC setup or a
relation created previously.  For example, row tracking for CTAS/COPY
was looking at the number of plans, which was not necessary, or level
tracking was mixed with checks on planner counts.

This commit refactors the tests of pg_stat_statements, by moving test
cases out of pg_stat_statements.sql into their own file, as of:
- Planning-related tests in planning.sql, for [re]plan counts and
top-level handling.  These depend on pg_stat_statements.track_planning.
- Utilities in utility.sql (pg_stat_statements.track_utility), that
includes now the tests for:
-- Row tracking for CTAS, CREATE MATERIALIZED VIEW, COPY.
-- Basic utility statements.
-- SET statements.
- Tracking level, depending on pg_stat_statements.track.  This part has
been looking at scenarios with DO blocks, PL functions and SQL
functions.

pg_stat_statements.sql (still named the same for now) still includes
some checks for role-level tracking and WAL generation metrics, that
ought to become independent in the long term for clarity.

While on it, this switches the order of the attributes when querying
pg_stat_statements, the query field becoming last.  This makes much
easier the tracking of changes related to normalization, as queries are
the only variable-length attributes queried (unaligned mode would be one
extra choice, but that reduces the checks on the other fields).

Test scenarios and their results match exactly with what was happening
before this commit in terms of calls, number of plans, number of rows,
cached data or level tracking, so this has no effect on the coverage in
terms of what is produced by the reports in the table
pg_stat_statements.  A follow-up patch will extend more the tests of
pg_stat_statements around utilities, so this split creates a foundation
for this purpose, without complicating more pg_stat_statements.sql.

Reviewed-by: Bertrand Drouvot
Discussion: https://postgr.es/m/Y+MRdEq9W9XVa2AB@paquier.xyz
2023-02-20 09:28:29 +09:00
..
adminpack Update copyright for 2023 2023-01-02 15:00:37 -05:00
amcheck Add tests for pg_stat_io 2023-02-11 10:05:04 -08:00
auth_delay Update copyright for 2023 2023-01-02 15:00:37 -05:00
auto_explain Make auto_explain print the query identifier in verbose mode 2023-01-26 12:23:16 +09:00
basebackup_to_shell Common function for percent placeholder replacement 2023-01-11 10:42:35 +01:00
basic_archive Redesign archive modules 2023-02-17 14:26:42 +09:00
bloom Update copyright for 2023 2023-01-02 15:00:37 -05:00
bool_plperl Update copyright for 2023 2023-01-02 15:00:37 -05:00
btree_gin Update copyright for 2023 2023-01-02 15:00:37 -05:00
btree_gist Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
citext Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
cube New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
dblink dblink: Fix variable confusion introduced in e4602483e9 2023-01-31 17:47:53 -08:00
dict_int Update copyright for 2023 2023-01-02 15:00:37 -05:00
dict_xsyn Update copyright for 2023 2023-01-02 15:00:37 -05:00
earthdistance Doc: improve commentary about providing our own definitions of M_PI. 2023-01-08 16:25:33 -05:00
file_fdw Update copyright for 2023 2023-01-02 15:00:37 -05:00
fuzzystrmatch New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
hstore Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
hstore_plperl Update copyright for 2023 2023-01-02 15:00:37 -05:00
hstore_plpython Update copyright for 2023 2023-01-02 15:00:37 -05:00
intagg Update copyright for 2023 2023-01-02 15:00:37 -05:00
intarray Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
isn Update copyright for 2023 2023-01-02 15:00:37 -05:00
jsonb_plperl Update copyright for 2023 2023-01-02 15:00:37 -05:00
jsonb_plpython Update copyright for 2023 2023-01-02 15:00:37 -05:00
lo Update copyright for 2023 2023-01-02 15:00:37 -05:00
ltree Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
ltree_plpython Update copyright for 2023 2023-01-02 15:00:37 -05:00
oid2name Update copyright for 2023 2023-01-02 15:00:37 -05:00
old_snapshot Update copyright for 2023 2023-01-02 15:00:37 -05:00
pageinspect Consolidate ItemPointer to Datum conversion functions 2023-02-13 09:57:15 +01:00
passwordcheck Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_buffercache Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_freespacemap Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_prewarm Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_stat_statements Refactor tests of pg_stat_statements for planning, utility and level tracking 2023-02-20 09:28:29 +09:00
pg_surgery Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
pg_trgm Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
pg_visibility Update copyright for 2023 2023-01-02 15:00:37 -05:00
pg_walinspect pg_walinspect: Add pg_get_wal_fpi_info() 2023-01-23 13:55:18 +09:00
pgcrypto New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
pgrowlocks Update copyright for 2023 2023-01-02 15:00:37 -05:00
pgstattuple Update copyright for 2023 2023-01-02 15:00:37 -05:00
postgres_fdw Fix various typos in code and tests 2023-02-09 14:43:53 +09:00
seg Update copyright for 2023 2023-01-02 15:00:37 -05:00
sepgsql Update copyright for 2023 2023-01-02 15:00:37 -05:00
spi Update copyright for 2023 2023-01-02 15:00:37 -05:00
sslinfo Update copyright for 2023 2023-01-02 15:00:37 -05:00
start-scripts Remove gratuitous references to postmaster program 2023-01-26 10:48:32 +01:00
tablefunc Update copyright for 2023 2023-01-02 15:00:37 -05:00
tcn Update copyright for 2023 2023-01-02 15:00:37 -05:00
test_decoding Remove uses of AssertVariableIsOfType() obsoleted by f2b73c8 2023-02-08 21:06:46 -08:00
tsm_system_rows Update copyright for 2023 2023-01-02 15:00:37 -05:00
tsm_system_time Update copyright for 2023 2023-01-02 15:00:37 -05:00
unaccent Update copyright for 2023 2023-01-02 15:00:37 -05:00
uuid-ossp New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
vacuumlo Update copyright for 2023 2023-01-02 15:00:37 -05:00
xml2 Update copyright for 2023 2023-01-02 15:00:37 -05:00
Makefile Revert "Rename contrib module basic_archive to basic_wal_module" 2023-01-26 09:13:39 +09:00
README Rename 'gmake' to 'make' in docs and recommended commands 2014-02-12 17:29:19 -05:00
contrib-global.mk Respect TEMP_CONFIG when pg_regress_check and friends are called 2016-02-27 12:28:21 -05:00
meson.build Revert "Rename contrib module basic_archive to basic_wal_module" 2023-01-26 09:13:39 +09:00

README

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.