pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix failure to detect some cases of improperly-nested aggregates
Date: Mon, 13 Mar 2023 16:40:46 +0000
Message-ID: <E1pblE5-003MBG-SA@gemulon.postgresql.org> (raw)

Fix failure to detect some cases of improperly-nested aggregates.

check_agg_arguments_walker() supposed that it needn't descend into
the arguments of a lower-level aggregate function, but this is
just wrong in the presence of multiple levels of sub-select.  The
oversight would lead to executor failures on queries that should
be rejected.  (Prior to v11, they actually were rejected, thanks
to a "redundant" execution-time check.)

Per bug #17835 from Anban Company.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/17835-4f29f3098b2d0ba4@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/62a91a1b092606e55d8a9807d249ceda58feebb0

Modified Files
--------------
src/backend/parser/parse_agg.c           | 3 +--
src/test/regress/expected/aggregates.out | 6 ++++++
src/test/regress/sql/aggregates.sql      | 3 +++
3 files changed, 10 insertions(+), 2 deletions(-)



view thread (6+ messages)

Message-ID: <E1pblE5-003MBG-SA@gemulon.postgresql.org>
Permalink:  ../E1pblE5-003MBG-SA@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pblE5-003MBG-SA@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: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix failure to detect some cases of improperly-nested aggregates
  In-Reply-To: <E1pblE5-003MBG-SA@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