バージョンごとのドキュメント一覧

53.2. pg_aggregate #

The catalog <structname>pg_aggregate</structname> 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 <function>sum</function>, <function>count</function>, and <function>max</function>. Each entry in <structname>pg_aggregate</structname> is an extension of an entry in <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>. The <structname>pg_proc</structname> entry carries the aggregate's name, input and output data types, and other information that is similar to ordinary functions. pg_aggregateカタログには集約関数の情報が格納されています。 集約関数とは、値の集合(多くの場合は問い合わせ条件に該当する各行の1つの列)にある操作を行い、それらすべての値の演算の結果得られる単一の値を返します。 集約関数の代表的なものはsumcountそしてmaxです。 pg_aggregate内の各項目は、pg_proc内の項目の拡張です。 pg_procの項目には、集約の名前、入出力データ型および通常の関数と類似したその他の情報が含まれます。

表53.2 pg_aggregateの列

<title><structname>pg_aggregate</structname> Columns</title>

Column Type 列 型

Description 説明

aggfnoid regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

<structname>pg_proc</structname> OID of the aggregate function pg_proc集約関数のOID

aggkind char

Aggregate kind: <literal>n</literal> for <quote>normal</quote> aggregates, <literal>o</literal> for <quote>ordered-set</quote> aggregates, or <literal>h</literal> for <quote>hypothetical-set</quote> aggregates 集約関数の種類: n = 通常の集約関数、 o = 順序集合の集約関数、 h = 仮想集合の集約関数

aggnumdirectargs int2

Number of direct (non-aggregated) arguments of an ordered-set or hypothetical-set aggregate, counting a variadic array as one argument. If equal to <structfield>pronargs</structfield>, 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. 順序集合や仮想集合の集約関数では、(集約されていない)複数の引数は、可変長配列として1個の引数と見なします。 引数が数がpronargsと同じ場合、最終的な直接引数同様、集約された引数として、集約関数の引数は、可変または可変長配列で記述しなければなりません。 通常の集約関数は引数を取りません。

aggtransfn regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

Transition function 遷移関数

aggfinalfn regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

Final function (zero if none) 最終関数(ない時はゼロ)

aggcombinefn regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

Combine function (zero if none) 結合関数(ない時はゼロ)

aggserialfn regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

Serialization function (zero if none) 直列化関数(ない時はゼロ)

aggdeserialfn regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

Deserialization function (zero if none) 逆直列化関数(ない時はゼロ)

aggmtransfn regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

Forward transition function for moving-aggregate mode (zero if none) 移動集約モードの順方向遷移関数(ない時はゼロ)

aggminvtransfn regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

Inverse transition function for moving-aggregate mode (zero if none) 移動集約モードの逆遷移関数(ない時はゼロ)

aggmfinalfn regproc (references <link linkend="catalog-pg-proc"><structname>pg_proc</structname></link>.<structfield>oid</structfield>) (参照先 pg_proc.oid

Final function for moving-aggregate mode (zero if none) 移動集約モードの最終関数(ない時はゼロ)

aggfinalextra bool

True to pass extra dummy arguments to <structfield>aggfinalfn</structfield> aggfinalfnに追加の仮引数を渡す場合はtrue

aggmfinalextra bool

True to pass extra dummy arguments to <structfield>aggmfinalfn</structfield> aggmfinalfnに追加の仮引数を渡す場合はtrue

aggfinalmodify char

Whether <structfield>aggfinalfn</structfield> modifies the transition state value: <literal>r</literal> if it is read-only, <literal>s</literal> if the <structfield>aggtransfn</structfield> cannot be applied after the <structfield>aggfinalfn</structfield>, or <literal>w</literal> if it writes on the value aggfinalfnが遷移状態値を変更するかどうか: r = 読み出し専用の場合、 s = aggfinalfnの後でaggtransfnを適用できない場合、 w = その値に書き込む場合

aggmfinalmodify char

Like <structfield>aggfinalmodify</structfield>, but for the <structfield>aggmfinalfn</structfield> aggmfinalfn用であることを除き、aggfinalmodifyと同様

aggsortop oid (references <link linkend="catalog-pg-operator"><structname>pg_operator</structname></link>.<structfield>oid</structfield>) (参照先 pg_operator.oid

Associated sort operator (zero if none) 関連するソート演算子(ない時はゼロ)

aggtranstype oid (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>) (参照先 pg_type.oid

Data type of the aggregate function's internal transition (state) data 集約関数の内部遷移(状態)データのデータ型

aggtransspace int4

Approximate average size (in bytes) of the transition state data, or zero to use a default estimate 遷移状態データの推定平均サイズ(バイト)、またはデフォルトの推定値であるゼロ

aggmtranstype oid (references <link linkend="catalog-pg-type"><structname>pg_type</structname></link>.<structfield>oid</structfield>) (参照先 pg_type.oid

Data type of the aggregate function's internal transition (state) data for moving-aggregate mode (zero if none) 移動集約モードの、集約関数の内部遷移(状態)データのデータ型(ない時はゼロ)

aggmtransspace int4

Approximate average size (in bytes) of the transition state data for moving-aggregate mode, or zero to use a default estimate 移動集約モードの、遷移状態データの推定平均サイズ(バイト)、またはデフォルトの推定値であるゼロ

agginitval text

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. 遷移状態の初期値。 外部文字列表現での初期値を含んだテキストフィールド。 フィールドがNULL値の場合、推移状態はNULL値で始まります。

aggminitval text

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. 移動集約モードの、遷移状態の初期値。外部に文字列表記された初期値を含むテキストフィールド。 このフィールドがNULLの場合、遷移状態の値はNULLから始まります。


New aggregate functions are registered with the <link linkend="sql-createaggregate"><command>CREATE AGGREGATE</command></link> command. See <xref linkend="xaggr"/> for more information about writing aggregate functions and the meaning of the transition functions, etc. 新しい集約関数はCREATE AGGREGATEコマンドで登録されます。 集約関数の書き方や遷移関数の説明などの詳細は38.12を参照してください。