From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow an aggregate's planner support function to be set via CREA
Date: Sun, 23 Aug 2026 16:43:09 +0000
Message-ID: <E1wyBHo-00000001mzZ-227u@gemulon.postgresql.org> (raw)
Allow an aggregate's planner support function to be set via CREATE AGGREGATE.
Commit 42473b3b3 implemented SupportRequestSimplifyAggref, but failed
to think about what infrastructure would be required for an extension
to use that: there is no SQL-level mechanism for attaching a planner
support function to an aggregate. That seems pretty critical for a
feature that's primarily intended to be used by extensions.
To fix, add a SUPPORT clause to CREATE AGGREGATE, and teach pg_dump
(and thereby pg_upgrade) about dumping this aggregate property.
We don't need to touch ALTER AGGREGATE, because it's already the case
that you're supposed to use CREATE OR REPLACE AGGREGATE if you want
to alter any aggregate-specific properties set by CREATE AGGREGATE.
(Maybe at some point we'll think that that policy ought to change,
but I don't think this one feature moves the needle enough.)
Per report from Andrei Lepikhov, who also provided some of the
new documentation text.
Reported-by: Andrei Lepikhov <lepihov@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Discussion: https://postgr.es/m/8f58c96d-d3c7-4c0f-9898-116f00eeaff6@gmail.com
Backpatch-through: 19
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/8aa49d34e977affb21f3cdbf17661c9c64753f42
Modified Files
--------------
doc/src/sgml/ref/alter_aggregate.sgml | 7 ++++++
doc/src/sgml/ref/create_aggregate.sgml | 15 ++++++++++++
doc/src/sgml/xfunc.sgml | 18 +++++++++++++-
src/backend/catalog/pg_aggregate.c | 33 +++++++++++++++++++++++++-
src/backend/commands/aggregatecmds.c | 4 ++++
src/bin/pg_dump/pg_dump.c | 18 ++++++++++++--
src/include/catalog/pg_aggregate.h | 1 +
src/test/regress/expected/create_aggregate.out | 15 ++++++++++++
src/test/regress/sql/create_aggregate.sql | 8 +++++++
9 files changed, 115 insertions(+), 4 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 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: Allow an aggregate's planner support function to be set via CREA
In-Reply-To: <E1wyBHo-00000001mzZ-227u@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