| From: | zengman <zengman(at)halodbtech(dot)com> |
|---|---|
| To: | Sami Imseih <samimseih(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz> |
| Subject: | Re: [[BUG] pg_stat_statements crashes with var and non-var expressions in IN clause |
| Date: | 2026-01-13 08:05:57 |
| Message-ID: | tencent_56D378713B3D126F1B4EE122@qq.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> If there is agreement to this fix, I think it should be backpacthed to
> all versions that
> support squashing of IN-lists.
Hi,
Thank you for providing the test case. I happened to have both versions 16 and 19 on hand — it stably triggers the issue on version 19, while version 16 works perfectly fine.
Additionally, I noticed that "ars" in the comment of your patch should be "Vars" (this seems to be a typo).
```
postgres(at)zxm-VMware-Virtual-Platform:~/code/postgres$ psql
psql (19devel)
Type "help" for help.
postgres=# SELECT * FROM test_squash a, test_squash b WHERE a.id IN (1, 2, 3,
b.id, b.id + 1);
TRAP: failed Assert("len_to_wrt >= 0"), File: "pg_stat_statements.c", Line: 2906, PID: 52564
postgres: postgres postgres [local] SELECT(ExceptionalCondition+0xbb)[0x59d71bc1d631]
```
```
postgres(at)zxm-VMware-Virtual-Platform:~$ psql
psql (16.11)
Type "help" for help.
postgres=# SELECT * FROM test_squash a, test_squash b WHERE a.id IN (1, 2, 3,
b.id, b.id + 1);
id | data | id | data
----+------+----+------
(0 rows)
postgres=# SELECT query, calls FROM pg_stat_statements ORDER BY query COLLATE "C";
query | calls
------------------------------------------------------------------------+-------
SELECT * FROM test_squash a, test_squash b WHERE a.id IN ($1, $2, $3, +| 2
b.id, b.id + $4) |
SELECT query, calls FROM pg_stat_statements ORDER BY query COLLATE "C" | 1
select pg_backend_pid() | 1
(3 rows)
```
--
Regards,
Man Zeng
www.openhalo.org
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-01-13 08:20:23 | Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL |
| Previous Message | Lukas Fittl | 2026-01-13 08:01:53 | Re: Stack-based tracking of per-node WAL/buffer usage |