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

53.58. pg_trigger #

The catalog <structname>pg_trigger</structname> stores triggers on tables and views. See <xref linkend="sql-createtrigger"/> for more information. pg_triggerカタログはテーブルおよびビュー上のトリガを保存します。 CREATE TRIGGERを参照してください。

表53.58 pg_triggerの列

<title><structname>pg_trigger</structname> Columns</title>

Column Type 列 型

Description 説明

oid oid

Row identifier 行識別子

tgrelid oid (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>) (参照先 pg_class.oid

The table this trigger is on トリガのかかっているテーブル

tgparentid oid (references <link linkend="catalog-pg-trigger"><structname>pg_trigger</structname></link>.<structfield>oid</structfield>) (参照先 pg_trigger.oid

Parent trigger that this trigger is cloned from (this happens when partitions are created or attached to a partitioned table); zero if not a clone このトリガが複製された親のトリガ(パーティションが作成されたか、あるいはパーティションテーブルにアタッチされたときに起こります)。 複製されていなければゼロ

tgname name

Trigger name (must be unique among triggers of same table) トリガ名(同一テーブル内で一意である必要があります)

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

The function to be called 呼び出される関数

tgtype int2

Bit mask identifying trigger firing conditions トリガ発行条件を指定するビットマスク

tgenabled char

Controls in which <xref linkend="guc-session-replication-role"/> modes the trigger fires. <literal>O</literal> = trigger fires in <quote>origin</quote> and <quote>local</quote> modes, <literal>D</literal> = trigger is disabled, <literal>R</literal> = trigger fires in <quote>replica</quote> mode, <literal>A</literal> = trigger fires always. どのsession_replication_roleモードでトリガが発行されるかを制御します。 O = 起点モードとローカルモードでトリガを発行します、 D = トリガは無効です、 R = replicaモードでトリガを発行します、 A = 常にトリガを発行します。

tgisinternal bool

True if trigger is internally generated (usually, to enforce the constraint identified by <structfield>tgconstraint</structfield>) トリガが(通常tgconstraintにより識別される制約を強制するために)内部的に生成される場合はtrue

tgconstrrelid oid (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>) (参照先 pg_class.oid

The table referenced by a referential integrity constraint (zero if trigger is not for a referential integrity constraint) 参照整合性制約で参照されるテーブル。 (トリガが参照整合性制約用でなければゼロ)

tgconstrindid oid (references <link linkend="catalog-pg-class"><structname>pg_class</structname></link>.<structfield>oid</structfield>) (参照先 pg_class.oid

The index supporting a unique, primary key, referential integrity, or exclusion constraint (zero if trigger is not for one of these types of constraint) 一意性、主キー、参照整合性制約や排他制約をサポートするインデックス (トリガがこれらの制約型用でなければゼロ)

tgconstraint oid (references <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link>.<structfield>oid</structfield>) (参照先 pg_constraint.oid

The <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> entry associated with the trigger (zero if trigger is not for a constraint) トリガに関連するpg_constraintの項目。 (トリガが制約用でなければゼロ)

tgdeferrable bool

True if constraint trigger is deferrable 制約トリガが遅延可能である場合はtrue

tginitdeferred bool

True if constraint trigger is initially deferred 制約トリガの初期状態が遅延可能と宣言されてる場合はtrue

tgnargs int2

Number of argument strings passed to trigger function トリガ関数に渡される引数の数

tgattr int2vector (references <link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link>.<structfield>attnum</structfield>) (参照先 pg_attribute.attnum

Column numbers, if trigger is column-specific; otherwise an empty array トリガが列固有であれば列番号。そうでなければ空の配列

tgargs bytea

Argument strings to pass to trigger, each NULL-terminated トリガに渡される引数文字列で、それぞれヌル文字で終結

tgqual pg_node_tree

Expression tree (in <function>nodeToString()</function> representation) for the trigger's <literal>WHEN</literal> condition, or null if none トリガのWHEN条件に関する(nodeToString()表現による)式ツリー、なければNULL

tgoldtable name

<literal>REFERENCING</literal> clause name for <literal>OLD TABLE</literal>, or null if none OLD TABLEに対するREFERENCING句の名前、なければNULL

tgnewtable name

<literal>REFERENCING</literal> clause name for <literal>NEW TABLE</literal>, or null if none NEW TABLEに対するREFERENCING句の名前、なければNULL


Currently, column-specific triggering is supported only for <literal>UPDATE</literal> events, and so <structfield>tgattr</structfield> is relevant only for that event type. <structfield>tgtype</structfield> might contain bits for other event types as well, but those are presumed to be table-wide regardless of what is in <structfield>tgattr</structfield>. 現在、列固有のトリガ処理はUPDATEイベントのみでサポートされていますので、tgattrはこの種類のイベントにのみ関連します。 tgtypeにはこの他のイベント用のビットが含まれているかもしれませんが、これらはtgattrの値とは関係ないテーブル全体のものであると仮定されます。

注記

When <structfield>tgconstraint</structfield> is nonzero, <structfield>tgconstrrelid</structfield>, <structfield>tgconstrindid</structfield>, <structfield>tgdeferrable</structfield>, and <structfield>tginitdeferred</structfield> are largely redundant with the referenced <link linkend="catalog-pg-constraint"><structname>pg_constraint</structname></link> entry. However, it is possible for a non-deferrable trigger to be associated with a deferrable constraint: foreign key constraints can have some deferrable and some non-deferrable triggers. tgconstraintがゼロではないとき、tgconstrrelidtgconstrindidtgdeferrabletginitdeferredは参照されるpg_constraint項目と共に冗長となっています。 しかし遅延不可能なトリガを遅延可能な制約に関連付けさせることが可能です。 外部キー制約では一部を遅延可能、一部を遅延不可能なトリガを持つことができます。

注記

<literal>pg_class.relhastriggers</literal> must be true if a relation has any triggers in this catalog. pg_class.relhastriggersは、リレーションがこのカタログ内にトリガを持っている場合はtrueでなければなりません。