From: Andrew Dunstan <andrew@dunslane.net>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix finalization for json_objectagg and friends
Date: Wed, 13 Apr 2022 14:38:06 +0000
Message-ID: <E1nee8E-000LRw-5V@gemulon.postgresql.org> (raw)
Fix finalization for json_objectagg and friends
Commit f4fb45d15c misguidedly tried to free some state during aggregate
finalization for json_objectagg. This resulted in attempts to access
freed memory, especially when the function is used as a window function.
Commit 4eb9798879 attempted to ameliorate that, but in fact it should
just be ripped out, which is done here. Also add some regression tests
for json_objectagg in various flavors as a window function.
Original report from Jaime Casanova, diagnosis by Andres Freund.
Discussion: https://postgr.es/m/YkfeMNYRCGhySKyg@ahch-to
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/112fdb3528465cc14a2f1dff3dc27f100326d885
Modified Files
--------------
src/backend/utils/adt/json.c | 12 ------------
src/test/regress/expected/sqljson.out | 35 +++++++++++++++++++++++++++++++++++
src/test/regress/sql/sqljson.sql | 18 ++++++++++++++++++
3 files changed, 53 insertions(+), 12 deletions(-)
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-committers@postgresql.org
Cc: andrew@dunslane.net
Subject: Re: pgsql: Fix finalization for json_objectagg and friends
In-Reply-To: <E1nee8E-000LRw-5V@gemulon.postgresql.org>
References: <E1nee8E-000LRw-5V@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