summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/catalog-pg-aggregate.html
blob: 27b9f448ff059311c58238a3af777d543a7d131e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>53.2. pg_aggregate</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="catalogs-overview.html" title="53.1. Overview" /><link rel="next" href="catalog-pg-am.html" title="53.3. pg_am" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">53.2. <code class="structname">pg_aggregate</code></th></tr><tr><td width="10%" align="left"><a accesskey="p" href="catalogs-overview.html" title="53.1. Overview">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><th width="60%" align="center">Chapter 53. System Catalogs</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="catalog-pg-am.html" title="53.3. pg_am">Next</a></td></tr></table><hr /></div><div class="sect1" id="CATALOG-PG-AGGREGATE"><div class="titlepage"><div><div><h2 class="title" style="clear: both">53.2. <code class="structname">pg_aggregate</code></h2></div></div></div><a id="id-1.10.4.4.2" class="indexterm"></a><p>
   The catalog <code class="structname">pg_aggregate</code> stores information about
   aggregate functions.  An aggregate function is a function that
   operates on a set of values (typically one column from each row
   that matches a query condition) and returns a single value computed
   from all these values.  Typical aggregate functions are
   <code class="function">sum</code>, <code class="function">count</code>, and
   <code class="function">max</code>.  Each entry in
   <code class="structname">pg_aggregate</code> is an extension of an entry
   in <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.
   The <code class="structname">pg_proc</code> entry carries the aggregate's name,
   input and output data types, and other information that is similar to
   ordinary functions.
  </p><div class="table" id="id-1.10.4.4.4"><p class="title"><strong>Table 53.2. <code class="structname">pg_aggregate</code> Columns</strong></p><div class="table-contents"><table class="table" summary="pg_aggregate Columns" border="1"><colgroup><col /></colgroup><thead><tr><th class="catalog_table_entry"><p class="column_definition">
       Column Type
      </p>
      <p>
       Description
      </p></th></tr></thead><tbody><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggfnoid</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       <code class="structname">pg_proc</code> OID of the aggregate function
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggkind</code> <code class="type">char</code>
      </p>
      <p>
       Aggregate kind:
       <code class="literal">n</code> for <span class="quote"><span class="quote">normal</span></span> aggregates,
       <code class="literal">o</code> for <span class="quote"><span class="quote">ordered-set</span></span> aggregates, or
       <code class="literal">h</code> for <span class="quote"><span class="quote">hypothetical-set</span></span> aggregates
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggnumdirectargs</code> <code class="type">int2</code>
      </p>
      <p>
       Number of direct (non-aggregated) arguments of an ordered-set or
       hypothetical-set aggregate, counting a variadic array as one argument.
       If equal to <code class="structfield">pronargs</code>, the aggregate must be variadic
       and the variadic array describes the aggregated arguments as well as
       the final direct arguments.
       Always zero for normal aggregates.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggtransfn</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Transition function
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggfinalfn</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Final function (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggcombinefn</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Combine function (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggserialfn</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Serialization function (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggdeserialfn</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Deserialization function (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggmtransfn</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Forward transition function for moving-aggregate mode (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggminvtransfn</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Inverse transition function for moving-aggregate mode (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggmfinalfn</code> <code class="type">regproc</code>
       (references <a class="link" href="catalog-pg-proc.html" title="53.39. pg_proc"><code class="structname">pg_proc</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Final function for moving-aggregate mode (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggfinalextra</code> <code class="type">bool</code>
      </p>
      <p>
       True to pass extra dummy arguments to <code class="structfield">aggfinalfn</code>
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggmfinalextra</code> <code class="type">bool</code>
      </p>
      <p>
       True to pass extra dummy arguments to <code class="structfield">aggmfinalfn</code>
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggfinalmodify</code> <code class="type">char</code>
      </p>
      <p>
       Whether <code class="structfield">aggfinalfn</code> modifies the
       transition state value:
       <code class="literal">r</code> if it is read-only,
       <code class="literal">s</code> if the <code class="structfield">aggtransfn</code>
       cannot be applied after the <code class="structfield">aggfinalfn</code>, or
       <code class="literal">w</code> if it writes on the value
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggmfinalmodify</code> <code class="type">char</code>
      </p>
      <p>
       Like <code class="structfield">aggfinalmodify</code>, but for
       the <code class="structfield">aggmfinalfn</code>
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggsortop</code> <code class="type">oid</code>
       (references <a class="link" href="catalog-pg-operator.html" title="53.34. pg_operator"><code class="structname">pg_operator</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Associated sort operator (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggtranstype</code> <code class="type">oid</code>
       (references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Data type of the aggregate function's internal transition (state) data
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggtransspace</code> <code class="type">int4</code>
      </p>
      <p>
       Approximate average size (in bytes) of the transition state
       data, or zero to use a default estimate
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggmtranstype</code> <code class="type">oid</code>
       (references <a class="link" href="catalog-pg-type.html" title="53.64. pg_type"><code class="structname">pg_type</code></a>.<code class="structfield">oid</code>)
      </p>
      <p>
       Data type of the aggregate function's internal transition (state)
       data for moving-aggregate mode (zero if none)
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggmtransspace</code> <code class="type">int4</code>
      </p>
      <p>
       Approximate average size (in bytes) of the transition state data
       for moving-aggregate mode, or zero to use a default estimate
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">agginitval</code> <code class="type">text</code>
      </p>
      <p>
       The initial value of the transition state.  This is a text
       field containing the initial value in its external string
       representation.  If this field is null, the transition state
       value starts out null.
      </p></td></tr><tr><td class="catalog_table_entry"><p class="column_definition">
       <code class="structfield">aggminitval</code> <code class="type">text</code>
      </p>
      <p>
       The initial value of the transition state for moving-aggregate mode.
       This is a text field containing the initial value in its external
       string representation.  If this field is null, the transition state
       value starts out null.
      </p></td></tr></tbody></table></div></div><br class="table-break" /><p>
   New aggregate functions are registered with the <a class="link" href="sql-createaggregate.html" title="CREATE AGGREGATE"><code class="command">CREATE AGGREGATE</code></a>
   command.  See <a class="xref" href="xaggr.html" title="38.12. User-Defined Aggregates">Section 38.12</a> for more information about
   writing aggregate functions and the meaning of the transition
   functions, etc.
  </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="catalogs-overview.html" title="53.1. Overview">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="catalogs.html" title="Chapter 53. System Catalogs">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="catalog-pg-am.html" title="53.3. pg_am">Next</a></td></tr><tr><td width="40%" align="left" valign="top">53.1. Overview </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 53.3. <code class="structname">pg_am</code></td></tr></table></div></body></html>