postgresql/src
Michael Paquier 5d95219faa pg_stat_statements: Fix crash in list squashing with Vars
When IN/ANY clauses contain both constants and variable expressions, the
optimizer transforms them into separate structures: constants become
an array expression while variables become individual OR conditions.

This transformation was creating an overlap with the token locations,
causing pg_stat_statements query normalization to crash because it
could not calculate the amount of bytes remaining to write for the
normalized query.

This commit disables squashing for mixed IN list expressions when
constructing a scalar array op, by setting list_start and list_end
to -1 when both variables and non-variables are present.  Some
regression tests are added to PGSS to verify these patterns.

Author: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0ts9qiONnHjjHxPxtePs22GBo4d3jZ_s2BQC59AN7XbAA@mail.gmail.com
Backpatch-through: 18
2026-01-20 08:11:12 +09:00
..
backend pg_stat_statements: Fix crash in list squashing with Vars 2026-01-20 08:11:12 +09:00
bin Don't set the truncation block length greater than RELSEG_SIZE. 2026-01-19 12:09:32 -05:00
common Remove #include <math.h> where not needed 2026-01-15 19:09:47 +01:00
fe_utils Add data type oid8, 64-bit unsigned identifier 2026-01-07 11:37:00 +09:00
include Add pg_clear_extended_stats() 2026-01-16 08:13:30 +09:00
interfaces Fix misc typos, mostly in comments 2026-01-08 18:10:08 +02:00
makefiles Decouple C++ support in Meson's PGXS from LLVM enablement 2026-01-09 10:25:02 +01:00
pl plpython: Streamline initialization 2026-01-15 12:11:52 +01:00
port strnlen() is now required 2026-01-08 08:51:20 +01:00
template
test Fix unsafe pushdown of quals referencing grouping Vars 2026-01-19 11:13:23 +09:00
timezone Update time zone data files to tzdata release 2025c. 2026-01-18 14:54:33 -05:00
tools Optimize LISTEN/NOTIFY via shared channel map and direct advancement. 2026-01-15 14:12:15 -05:00
tutorial Update copyright for 2026 2026-01-01 13:24:10 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in
Makefile.shlib
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
nls-global.mk