Hello Michael and Sami,
21.01.2026 02:41, Michael Paquier wrote:
On Tue, Jan 20, 2026 at 06:08:14PM -0600, Sami Imseih wrote:
While looking at pg_stat_statements nesting_level, I realized that there
are missing nesting_level tests for pgss_planner and pgss_ExecutorFinish.
That is, if you remove nesting_level++ and nesting_level-- in those 2 hooks,
the tests will still succeed.
For pgss_planner the nesting_level updates missing tests are the ones
when track_planning is enabled.
Attached is a quick patch to add coverage.
Confirmed these two deficiencies, nice catch. If one does the same
removal of the nesting level calculation in other code paths like
pgss_ExecutorRun(), one get complaints. Will see to get this addition
done.
Two buildfarm animals [1], [2] say that that addition is incompatible with
the CLOBBER_CACHE_ALWAYS mode:
not ok 5 - level_tracking 52571 ms
diff -U3 /home/buildfarm/avocet/buildroot/HEAD/pgsql.build/contrib/pg_stat_statements/expected/level_tracking.out
/home/buildfarm/avocet/buildroot/HEAD/pgsql.build/contrib/pg_stat_statements/results/level_tracking.out
--- /home/buildfarm/avocet/buildroot/HEAD/pgsql.build/contrib/pg_stat_statements/expected/level_tracking.out 2026-01-22
01:59:12.213054121 +0100
+++ /home/buildfarm/avocet/buildroot/HEAD/pgsql.build/contrib/pg_stat_statements/results/level_tracking.out 2026-01-22
05:24:17.363666155 +0100
@@ -1560,7 +1560,7 @@
toplevel | calls | rows | plans | query
----------+-------+------+-------+--------------------------------------------------------------------
t | 2 | 2 | 2 | SELECT PLUS_THREE($1)
- f | 2 | 2 | 2 | SELECT i + 3 LIMIT 1
+ f | 2 | 2 | 2 | SELECT i + $2 LIMIT $3
t | 1 | 1 | 0 | SELECT pg_stat_statements_reset() IS NOT
NULL AS t
t | 0 | 0 | 1 | SELECT toplevel, calls, rows, plans, query
FROM pg_stat_statements+
| | | | ORDER BY query COLLATE "C"
I can reproduce this locally with no extra tricks. Could you please adjust
the test for this mode?
[1]
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=avocet&dt=2026-01-22%2000%3A58%3A36
[2]
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=trilobite&dt=2026-01-24%2023%3A10%3A13
Best regards,
Alexander