pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Álvaro Herrera <alvherre@kurilemu.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Make query jumbling also squash PARAM_EXTERN params
Date: Tue, 24 Jun 2025 17:42:58 +0000
Message-ID: <E1uU7fd-0039z9-3C@gemulon.postgresql.org> (raw)

Make query jumbling also squash PARAM_EXTERN params

Commit 62d712ecfd94 made query jumbling squash lists of Consts as a
single element, but there's no reason not to treat PARAM_EXTERN
parameters the same.  For these purposes, these values are indeed
constants for any particular execution of a query.

In particular, this should make list squashing more useful for
applications using extended query protocol, which would use parameters
extensively.

A complication arises: if a query has both external parameters and
squashable lists, then the parameter number used as placeholder for the
squashed list might be inconsistent with regards to the parameter
numbers used by the query literal.  To reduce the surprise factor, all
parameters are renumbered starting from 1 in that case.

Author: Sami Imseih <samimseih@gmail.com>
Author: Dmitry Dolgov <9erthalion6@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAA5RZ0tRXoPG2y6bMgBCWNDt0Tn=unRerbzYM=oW0syi1=C1OA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/c2da1a5d6325a92d834c9cb036f65d362e4bfc3e

Modified Files
--------------
contrib/pg_stat_statements/expected/extended.out  |  60 ++++++--
contrib/pg_stat_statements/expected/squashing.out |  26 ++--
contrib/pg_stat_statements/pg_stat_statements.c   |  10 ++
contrib/pg_stat_statements/sql/extended.sql       |  11 +-
contrib/pg_stat_statements/sql/squashing.sql      |   4 +-
src/backend/nodes/queryjumblefuncs.c              | 160 +++++++++++++---------
src/include/nodes/primnodes.h                     |   6 +-
src/include/nodes/queryjumble.h                   |  19 ++-
8 files changed, 198 insertions(+), 98 deletions(-)



Message-ID: <E1uU7fd-0039z9-3C@gemulon.postgresql.org>
Permalink:  ../E1uU7fd-0039z9-3C@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uU7fd-0039z9-3C@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: alvherre@kurilemu.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Make query jumbling also squash PARAM_EXTERN params
  In-Reply-To: <E1uU7fd-0039z9-3C@gemulon.postgresql.org>

* 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