From: Michael Paquier <michael@paquier.xyz>
To: Staroverov Ilja <i.staroverov@ftdata.ru>
Cc: Sami Imseih <samimseih.pg@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: pg_stat_statements replaces SQL/JSON ON EMPTY / ON ERROR keywords with parameters
Date: Wed, 21 Oct 2026 15:42:58 +0900
Message-ID: <athe8udYm0H_xy0q@paquier.xyz> (raw)
In-Reply-To: <457969A9-5D24-422F-B09E-F388053DE028@localhost.localdomain>
References: <457969A9-5D24-422F-B09E-F388053DE028@localhost.localdomain>
On Mon, Oct 19, 2026 at 05:16:42AM +0000, Staroverov Ilja wrote:
> A correction to my previous message: it's not the number of columns
> that was part of the query ID, but the references to the columns from
> the rest of the query, such as the expansion of SELECT *. The commit
> message now says that.
>
> The test in 0002 now also checks that queries which differ only in
> column names or path names are merged, and that columns without PATH
> and with different names are not. The PLAN clause doesn't exist in
> REL_19_STABLE, so the test doesn't use it; I checked those cases on
> master by hand. The series applies to master and REL_19_STABLE, and
> I've tested it on both.
When it comes to such problems, I'd suggest to implement the tests as
a first patch, then do the jumbling logic in a second patch that shows
the changes in PGSS. It's easier to see what you think is the "wrong"
information and what becomes the "right" information ("wrong" and
"right" mean what you think is OK or not OK in terms of PGSS
monitoring).
+ 2 | SELECT * FROM JSON_TABLE($1::jsonb, $2 +
+ | COLUMNS (a int PATH $3 DEFAULT $4 ON EMPTY)) jt
+ 1 | SELECT * FROM JSON_TABLE($1::jsonb, $2 +
+ | COLUMNS (a int PATH $3)) jt
+ 2 | SELECT * FROM JSON_TABLE($1::jsonb, $2 +
+ | COLUMNS (a int PATH $3, +
+ | NESTED PATH $4 AS p1 COLUMNS (b int PATH $5))) jt
+ 1 | SELECT * FROM JSON_TABLE($1::jsonb, $2 +
+ | COLUMNS (a int)) jt
+ 1 | SELECT * FROM JSON_TABLE($1::jsonb, $2 +
+ | COLUMNS (a text PATH $3)) jt
+ 1 | SELECT * FROM JSON_TABLE($1::jsonb, $2 +
+ | COLUMNS (b int)) jt
There are many more keyword patterns than the ones tested here, like
PASSING, PLAN (UNION, OUTER ..), FORMAT JSON, etc. None of them are
covered. I guess that you may want to worry about them.
Instead of bloating more select.sql, let's move the JSON tests into a
different input file. They can be isolated, and there are way more
patterns than what you are showing here.
Note that none of this is backpatchable, as this impacts the Node
definitions and the query IDs computed.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: michael@paquier.xyz, i.staroverov@ftdata.ru, samimseih.pg@gmail.com
Subject: Re: pg_stat_statements replaces SQL/JSON ON EMPTY / ON ERROR keywords with parameters
In-Reply-To: <athe8udYm0H_xy0q@paquier.xyz>
References: <457969A9-5D24-422F-B09E-F388053DE028@localhost.localdomain> <athe8udYm0H_xy0q@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox