1/*-------------------------------------------------------------------------
4 * definition of the "aggregate" system catalog (pg_aggregate)
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/catalog/pg_aggregate.h
13 * The Catalog.pm module reads this file and derives schema
16 *-------------------------------------------------------------------------
22#include "catalog/pg_aggregate_d.h" /* IWYU pragma: export */
27/* ----------------------------------------------------------------
28 * pg_aggregate definition.
29 * cpp turns this into typedef struct FormData_pg_aggregate
30 * ----------------------------------------------------------------
32 CATALOG(pg_aggregate,2600,AggregateRelationId)
34 /* pg_proc OID of the aggregate itself */
37 /* aggregate kind, see AGGKIND_ categories below */
40 /* number of arguments that are "direct" arguments */
43 /* transition function */
46 /* final function (0 if none) */
49 /* combine function (0 if none) */
52 /* function to convert transtype to bytea (0 if none) */
55 /* function to convert bytea to transtype (0 if none) */
58 /* forward function for moving-aggregate mode (0 if none) */
61 /* inverse function for moving-aggregate mode (0 if none) */
64 /* final function for moving-aggregate mode (0 if none) */
67 /* true to pass extra dummy arguments to aggfinalfn */
70 /* true to pass extra dummy arguments to aggmfinalfn */
73 /* tells whether aggfinalfn modifies transition state */
76 /* tells whether aggmfinalfn modifies transition state */
79 /* associated sort operator (0 if none) */
82 /* type of aggregate's transition (state) data */
85 /* estimated size of state data (0 for default estimate) */
88 /* type of moving-aggregate state data (0 if none) */
91 /* estimated size of moving-agg state (0 for default est) */
94#ifdef CATALOG_VARLEN /* variable-length fields start here */
96 /* initial value for transition state (can be NULL) */
99 /* initial value for moving-agg state (can be NULL) */
105 * Form_pg_aggregate corresponds to a pointer to a tuple with
106 * the format of pg_aggregate relation.
117#ifdef EXPOSE_TO_CLIENT_CODE
120 * Symbolic values for aggkind column. We distinguish normal aggregates
121 * from ordered-set aggregates (which have two sets of arguments, namely
122 * direct and aggregated arguments) and from hypothetical-set aggregates
123 * (which are a subclass of ordered-set aggregates in which the last
124 * direct arguments have to match up in number and datatypes with the
125 * aggregated arguments).
127#define AGGKIND_NORMAL 'n'
128#define AGGKIND_ORDERED_SET 'o'
129#define AGGKIND_HYPOTHETICAL 'h'
131/* Use this macro to test for "ordered-set agg including hypothetical case" */
132#define AGGKIND_IS_ORDERED_SET(kind) ((kind) != AGGKIND_NORMAL)
135 * Symbolic values for aggfinalmodify and aggmfinalmodify columns.
136 * Preferably, finalfns do not modify the transition state value at all,
137 * but in some cases that would cost too much performance. We distinguish
138 * "pure read only" and "trashes it arbitrarily" cases, as well as the
139 * intermediate case where multiple finalfn calls are allowed but the
140 * transfn cannot be applied anymore after the first finalfn call.
142#define AGGMODIFY_READ_ONLY 'r'
143#define AGGMODIFY_SHAREABLE 's'
144#define AGGMODIFY_READ_WRITE 'w'
146#endif /* EXPOSE_TO_CLIENT_CODE */
156 Datum allParameterTypes,
157 Datum parameterModes,
158 Datum parameterNames,
159 List *parameterDefaults,
161 List *aggtransfnName,
162 List *aggfinalfnName,
163 List *aggcombinefnName,
164 List *aggserialfnName,
165 List *aggdeserialfnName,
166 List *aggmtransfnName,
167 List *aggminvtransfnName,
168 List *aggmfinalfnName,
169 bool finalfnExtraArgs,
170 bool mfinalfnExtraArgs,
177 int32 aggmTransSpace,
178 const char *agginitval,
179 const char *aggminitval,
182#endif /* PG_AGGREGATE_H */
#define BKI_LOOKUP(catalog)
#define BKI_DEFAULT(value)
#define BKI_LOOKUP_OPT(catalog)
DECLARE_UNIQUE_INDEX_PKEY(pg_aggregate_fnoid_index, 2650, AggregateFnoidIndexId, pg_aggregate, btree(aggfnoid oid_ops))
ObjectAddress AggregateCreate(const char *aggName, Oid aggNamespace, bool replace, char aggKind, int numArgs, int numDirectArgs, oidvector *parameterTypes, Datum allParameterTypes, Datum parameterModes, Datum parameterNames, List *parameterDefaults, Oid variadicArgType, List *aggtransfnName, List *aggfinalfnName, List *aggcombinefnName, List *aggserialfnName, List *aggdeserialfnName, List *aggmtransfnName, List *aggminvtransfnName, List *aggmfinalfnName, bool finalfnExtraArgs, bool mfinalfnExtraArgs, char finalfnModify, char mfinalfnModify, List *aggsortopName, Oid aggTransType, int32 aggTransSpace, Oid aggmTransType, int32 aggmTransSpace, const char *agginitval, const char *aggminitval, char proparallel)
CATALOG(pg_aggregate, 2600, AggregateRelationId)
FormData_pg_aggregate * Form_pg_aggregate
MAKE_SYSCACHE(AGGFNOID, pg_aggregate_fnoid_index, 16)
DECLARE_TOAST(pg_aggregate, 4159, 4160)