pgsql: Fix failure to detect some cases of improperly-nested aggregates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix failure to detect some cases of improperly-nested aggregates
Date: 2023-03-13 16:40:46
Message-ID: E1pblE5-003MB6-Q8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/30dbdbe75384bcb034172c781b24bc982434a967

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2023-03-13 18:58:34 Re: pgsql: Add standard collation UNICODE
Previous Message Andrew Dunstan 2023-03-13 14:12:32 pgsql: Add a DEFAULT option to COPY FROM