CREATE AGGREGATE

A DDL command for defining a new aggregate function

CREATE AGGREGATE is a DDL command for defining a new aggregate function.

CREATE AGGREGATE has always been present in PostgreSQL.

Change history

  • PostgreSQL 12
    • OR REPLACE syntax added (commit 01bde4fa)
  • PostgreSQL 11
    • support for tracking whether aggregate final functions modify transition state (commit 4de2d4fb)
  • PostgreSQL 9.6
    • support for serialization and deserialization of aggregate transition states (commit 5fe5a2ce)
    • support for multi-stage aggregation (commit a7de3dc5)
    • PARALLEL option added (commit 5fe5a2ce)
  • PostgreSQL 9.4
    • options for moving-aggregate optimization added (commit a9d9acbf)
    • options enabling polymorphic aggregates to have non-polymorphic state data types added (commit f0fedfe8)
    • support for VARIADIC aggregate functions (commit 0d3f4406)
    • support for ordered-set (WITHIN GROUP) aggregate functions (commit 8d65da1f)
  • PostgreSQL 8.2
    • new syntax CREATE AGGREGATE name (input_data_type [, ...]) (parameter_list) added (commit 3651a3e6)

Note: while new syntax was introduced in PostgreSQL 8.2, the old syntax is retained for backwards compatibility.

Categories

DDL, Functions and procedures, SQL command

See also

ALTER AGGREGATE, DROP AGGREGATE