agora inbox for pgsql-hackers@postgresql.org
help / color / mirror / Atom feedFrom: Julien Rouhaud <rjuju123@gmail.com>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Sami Imseih <samimseih@gmail.com>
Cc: Álvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Kirill Reshke <reshkekirill@gmail.com>
Cc: Sergei Kornilov <sk@zsrv.org>
Cc: yasuo.honda@gmail.com, tgl@sss.pgh.pa.us, smithpb2250@gmail.com, vignesh21@gmail.com, michael@paquier.xyz, nathandbossart@gmail.com, stark.cfm@gmail.com, geidav.pg@gmail.com, marcos@f10.com.br, robertmhaas@gmail.com, david@pgmasters.net, pgsql-hackers@postgresql.org, pavel.trukhanov@gmail.com, Sutou Kouhei <kou@clear-code.com>
Subject: Re: pg_stat_statements and "IN" conditions
Date: Fri, 14 Feb 2025 22:39:45 +0800
Message-ID: <Z69VsdpMfHZCuMK5@jrouhaud> (raw)
In-Reply-To: <nwseuxutrhemosezhwvzyjdnwvpdrv7gmwqdj6cqc55xdrpnm6@h5pw65h4elkp>
References: <Z68MtDCGVZi-Qqry@jrouhaud>
<202502140936.lni5gtrycnzf@alvherre.pgsql>
<Z68Tba4x2N2FaER_@jrouhaud>
<7vjscmc3ybcibtyetdufrevyyl2hxpcpnofn2eygnne46owmql@gofozgqyq722>
<CAA5RZ0st9R2V+E_QnVx2KivJFZbYgDVsm70TS=bO8T7XByFfZA@mail.gmail.com>
<nwseuxutrhemosezhwvzyjdnwvpdrv7gmwqdj6cqc55xdrpnm6@h5pw65h4elkp>
On Fri, Feb 14, 2025 at 03:20:24PM +0100, Dmitry Dolgov wrote:
>
> Btw, there was another mistake in the last version introducing
> "$1 /*, ... */" format, the constant position has to be of course
> calculated as usual.
I'm not sure what you mean here, but just in case:
> +SELECT * FROM test_merge WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9) AND data = 2;
> + id | data
> +----+------
> +(0 rows)
> +
> +SELECT * FROM test_merge WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10) AND data = 2;
> + id | data
> +----+------
> +(0 rows)
> +
> +SELECT * FROM test_merge WHERE id IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11) AND data = 2;
> + id | data
> +----+------
> +(0 rows)
> +
> +SELECT query, calls FROM pg_stat_statements ORDER BY query COLLATE "C";
> + query | calls
> +--------------------------------------------------------------------+-------
> + SELECT * FROM test_merge WHERE id IN ($1 /*, ... */) AND data = $3 | 3
> + SELECT pg_stat_statements_reset() IS NOT NULL AS t | 1
> +(2 rows)
There seems to be an off-by-1 error in parameter numbering when merging them.
Note that the query text as-is can still be successfully be used in an EXPLAIN
(GENERIC_PLAN), but it might cause problem to third party tools that try to do
something smarter about the parameters.
view thread (155+ messages) latest in thread
Message-ID: <Z69VsdpMfHZCuMK5@jrouhaud>
Permalink: ../Z69VsdpMfHZCuMK5@jrouhaud/
Also on: postgresql.org/message-id/Z69VsdpMfHZCuMK5@jrouhaud
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: rjuju123@gmail.com, 9erthalion6@gmail.com, samimseih@gmail.com, alvherre@alvh.no-ip.org, reshkekirill@gmail.com, sk@zsrv.org, kou@clear-code.com
Subject: Re: pg_stat_statements and "IN" conditions
In-Reply-To: <Z69VsdpMfHZCuMK5@jrouhaud>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox