From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Ensure result of an aggregate's finalfunc is made read-only. |
Date: | 2023-04-16 18:16:51 |
Message-ID: | E1po6vi-003OUd-28@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Ensure result of an aggregate's finalfunc is made read-only.
The finalfunc might return a read-write expanded object. If we
de-duplicate multiple call sites for the aggregate, any function(s)
receiving the aggregate result earlier could alter or destroy the
value that reaches the ones called later. This is a brown-paper-bag
bug in commit 42b746d4c, because we actually considered the need
for read-only-ness but failed to realize that it applied to the case
with a finalfunc as well as the case without.
Per report from Justin Pryzby. New error in HEAD,
no need for back-patch.
Discussion: https://postgr.es/m/ZDm5TuKsh3tzoEjz@telsasoft.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/78d5952dd0e66afc4447eec07f770991fa406cce
Modified Files
--------------
src/backend/executor/nodeAgg.c | 18 +++++++++++----
src/backend/executor/nodeWindowAgg.c | 7 +++++-
src/test/regress/expected/aggregates.out | 37 ++++++++++++++++++++++++++++++
src/test/regress/sql/aggregates.sql | 39 ++++++++++++++++++++++++++++++++
4 files changed, 96 insertions(+), 5 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2023-04-16 21:30:05 | pgsql: Doc: remove notes about the version vacuumdb options are valid f |
Previous Message | Tom Lane | 2023-04-16 16:57:39 | pgsql: Avoid using non-ASCII commentary in daitch_mokotoff.c. |