postgresql/contrib/pg_stat_statements/sql
Michael Paquier 72e3abd082 pg_stat_statements: Fix test instability with cache-clobbering builds
Builds with CLOBBER_CACHE_ALWAYS enabled are failing the new test
introduced in 1572ea96e6, checking the nesting level calculation in
the planner hook.  The inner query of the function called twice is
registered as normalized, as such builds would register a PGSS entry in
the post-parse-analyse hook due to the cached plans requiring
revalidation.

A trick based on debug_discard_caches cannot work as far as I can, a
normalized query still being registered.  This commit takes a different
approach with the addition of a DISCARD PLANS before the first function
call.  This forces the use of a normalized query in the PGSS entry for
the inner query of the function with and without CLOBBER_CACHE_ALWAYS,
which should be enough to stabilize the test.  Note that the test is
still checking what it should: when removing the nesting level
calculation in the planner hook of PGSS, one still gets a failure for
the PGSS entry of the inner query in the function, with "toplevel" being
flipped to true instead of false (it should be false, as a non-top-level
entry).

Per buildfarm members avocet and trilobite, at least.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/82dd02bb-4e0f-40ad-a60b-baa1763ff0bd@gmail.com
2026-01-25 19:01:23 +09:00
..
cleanup.sql Refactor tests of pg_stat_statements for planning, utility and level tracking 2023-02-20 09:28:29 +09:00
cursors.sql Show sizes of FETCH queries as constants in pg_stat_statements 2025-07-02 08:39:25 +09:00
dml.sql Add NOT NULL checking of pg_stat_statements_reset() in tests 2023-11-27 02:52:17 +02:00
entry_timestamp.sql Track statement entry timestamp in contrib/pg_stat_statements 2023-11-27 02:52:17 +02:00
extended.sql Make query jumbling also squash PARAM_EXTERN params 2025-06-24 19:36:32 +02:00
level_tracking.sql pg_stat_statements: Fix test instability with cache-clobbering builds 2026-01-25 19:01:23 +09:00
oldextversions.sql pg_stat_statements: Add counters for generic and custom plans 2025-07-31 11:37:37 +09:00
parallel.sql pg_stat_statements: Add columns to track parallel worker activity 2024-10-09 08:30:45 +09:00
plancache.sql pg_stat_statements: Add counters for generic and custom plans 2025-07-31 11:37:37 +09:00
planning.sql Revert support for improved tracking of nested queries 2025-06-12 10:08:55 +09:00
privileges.sql pg_stat_statements: Add regression test for privilege handling. 2024-07-24 20:54:51 +09:00
select.sql Fix query jumbling with GROUP BY clauses 2026-01-14 08:44:12 +09:00
squashing.sql pg_stat_statements: Rework test order 2026-01-21 07:47:38 +09:00
user_activity.sql Add NOT NULL checking of pg_stat_statements_reset() in tests 2023-11-27 02:52:17 +02:00
utility.sql pg_stat_statements: Expand tests for SET statements 2024-09-25 10:04:44 +09:00
wal.sql Add NOT NULL checking of pg_stat_statements_reset() in tests 2023-11-27 02:52:17 +02:00