| From: | Dmitry Dolgov <9erthalion6(at)gmail(dot)com> |
|---|---|
| To: | Sami Imseih <samimseih(at)gmail(dot)com> |
| Cc: | Konstantin Knizhnik <knizhnik(at)garret(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Bug in pg_stat_statements |
| Date: | 2025-10-24 13:39:42 |
| Message-ID: | n3frj5fgiesu4o2uupviijusigqw42qvxymupq3czdiljfj2ik@ehvug46al5qq |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Thu, Oct 23, 2025 at 07:49:55PM -0500, Sami Imseih wrote:
> I believe the correct answer is to fix this in queryjumblefuncs.c
> and more specifically inside _jumbleElements. We should not
> record the same location twice. We can do this by tracking the
> start location of the last recorded constant location, and we
> can skip recording it if we see it again. See the attached
> which also includes test cases.
I think there is another option. Before squashing implementation, duplicated
constants were dealt with in fill_in_constant_lengths -- after processing their
length was -1 and such constants were skipped further down the line. After
0f65f3eec, if such a constant is supposed to be squashed we now ignore it, but
set the length anyway in RecordConstLocation:
if (locs[i].squashed)
continue; /* squashable list, ignore */
if (loc <= last_loc)
continue; /* Duplicate constant, ignore */
This sort of short cut the verification for duplicated constants. Having said
that it seems that another solution would be to check for duplicated constants
in fill_in_constant_lengths just before skipping squashed constants and reset
the length if needed.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bryan Green | 2025-10-24 13:55:08 | Re: Avoid handle leak (src/bin/pg_ctl/pg_ctl.c) |
| Previous Message | Nazir Bilal Yavuz | 2025-10-24 13:20:00 | ci: Improve OpenBSD core dump backtrace handling |