| From: | Michael Paquier <michael(at)paquier(dot)xyz> |
|---|---|
| To: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
| Cc: | Sami Imseih <samimseih(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: pg_stat_statements: add missing tests for nesting_level |
| Date: | 2026-01-25 07:41:22 |
| Message-ID: | aXXJIorDJDdxReF9@paquier.xyz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Jan 25, 2026 at 08:00:00AM +0200, Alexander Lakhin wrote:
> I can reproduce this locally with no extra tricks. Could you please adjust
> the test for this mode?
Reproduced here. That was trickier than it looks. A trick with
debug_discard_caches cannot help, because with a CLOBBER_CACHE_ALWAYS
build we would still do a GetCachedPlan() -> RevalidateCachedQuery()
that goes through the post-parse analyze hook where the query would
still be normalized, showing up in the output anyway.
So I have come up with a plan B. If we do a DISCARD PLANS before the
*first* function call, we can force the test to revalidate the cached
query without caring about CLOBBER_CACHE_ALWAYS, meaning that we would
always store a normalized version of the inner query. The point of
the test is to check after the nesting level calculation in the
planner hook, and the test is still able to check that correctly. If
I remove the nesting_level bits from the code while the DISCARD is
around, the entry is stored as a top level entry incorrectly, but it
should be stored as toplevel=false. I'll go apply the attached
shortly, after some more checks..
--
Michael
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Fix-PGSS-test.patch | text/x-diff | 2.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dean Rasheed | 2026-01-25 10:03:05 | Re: ABI Compliance Checker GSoC Project |
| Previous Message | Tender Wang | 2026-01-25 07:20:48 | Re: Fix a reference error for window functions: In the function 'find_window_functions', the deduplication logic should be removed |