Re: BUG #18947: TRAP: failed Assert("len_to_wrt >= 0") in pg_stat_statements
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>, Dilip Kumar <dilipbalaut@gmail.com>, a.kozhemyakin@postgrespro.ru, pgsql-bugs@lists.postgresql.org
Date: 2025-06-12T23:50:46Z
Lists: pgsql-bugs
On Thu, Jun 12, 2025 at 08:46:26AM +0900, Michael Paquier wrote: > Anyway, I am going to pull the plug on this one today, because we need > to take a decision with beta2 approaching fast but it's mostly me > being not fully confident that this is right as-is. If we're wrong in > one path, that's an out-of-bound memory write waiting for us in PGSS > for the query normalization, as this report proves, and that would be > bad. Two things that I have in mind regarding all that, worth dumping now: - 06450c7b8c70 is reverted, but I have kept the test introduced in this commit to check the location of multiple queries separated by semicolons. This was something that we failed to track in the tree, with David Steele's pgaudit only providing coverage. - About the tests we could do to validate more in depth the locations and lengths assigned to the parsed node without relying on PGSS and EXPLAIN, which will support never support the full range of things like views. I was wondering about the addition of a test module that plugs into one or more hooks (only the post-parse one should be enough), where we simply print the Nodes generated to a string using the facility in src/backend/nodes/print.c. It would be then possible to filter the output generated with some regex magic to print the fields we want to check. That would work for the CREATE VIEW case, for example, and it could be used for other things than just the statement length and/or locations set in a gIven Node. -- Michael
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Revert support for improved tracking of nested queries
- f85f6ab051b7 18.0 landed
-
psql: fix order of join clauses when listing extensions
- 112e40b867b3 18.0 cited