postgresql/contrib/pg_stat_statements/expected
Álvaro Herrera b1635c1666
pg_stat_statements: Fix handling of duplicate constant locations
Two or more constants can have the same location.  We handled this
correctly for non squashed constants, but failed to do it if squashed
(resulting in out-of-bounds memory access), because the code structure
became broken by commit 0f65f3eec4: we failed to update 'last_loc'
correctly when skipping these squashed constants.

The simplest fix seems to be to get rid of 'last_loc' altogether -- in
hindsight, it's quite pointless.  Also, when ignoring a constant because
of this, make sure to fulfill fill_in_constant_lengths's duty of setting
its length to -1.

Lastly, we can use == instead of <= because the locations have been
sorted beforehand, so the < case cannot arise.

Co-authored-by: Sami Imseih <samimseih@gmail.com>
Co-authored-by: Dmitry Dolgov <9erthalion6@gmail.com>
Reported-by: Konstantin Knizhnik <knizhnik@garret.ru>
Backpatch-through: 18
Discussion: https://www.postgresql.org/message-id/2b91e358-0d99-43f7-be44-d2d4dbce37b3%40garret.ru
2025-10-29 12:35:02 +01:00
..
cleanup.out Refactor tests of pg_stat_statements for planning, utility and level tracking 2023-02-20 09:28:29 +09:00
cursors.out Add NOT NULL checking of pg_stat_statements_reset() in tests 2023-11-27 02:52:17 +02:00
dml.out Remove the query_id_squash_values GUC 2025-03-27 13:33:37 +01:00
entry_timestamp.out Track statement entry timestamp in contrib/pg_stat_statements 2023-11-27 02:52:17 +02:00
extended.out Make query jumbling also squash PARAM_EXTERN params 2025-06-24 19:36:32 +02:00
level_tracking.out Revert support for improved tracking of nested queries 2025-06-12 10:08:55 +09:00
oldextversions.out pg_stat_statements: Add wal_buffers_full 2025-02-17 13:55:17 +09:00
parallel.out pg_stat_statements: Add columns to track parallel worker activity 2024-10-09 08:30:45 +09:00
planning.out Revert support for improved tracking of nested queries 2025-06-12 10:08:55 +09:00
privileges.out pg_stat_statements: Add regression test for privilege handling. 2024-07-24 20:54:51 +09:00
select.out Fix squashing algorithm for query texts 2025-06-12 14:21:21 +02:00
squashing.out pg_stat_statements: Fix handling of duplicate constant locations 2025-10-29 12:35:02 +01:00
user_activity.out Add NOT NULL checking of pg_stat_statements_reset() in tests 2023-11-27 02:52:17 +02:00
utility.out Revert support for improved tracking of nested queries 2025-06-12 10:08:55 +09:00
wal.out Show values of SET statements as constants in pg_stat_statements 2024-09-30 14:02:00 +09:00