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

53.7. pg_attribute #

The catalog <structname>pg_attribute</structname> stores information about table columns. There will be exactly one <structname>pg_attribute</structname> row for every column in every table in the database. (There will also be attribute entries for indexes, and indeed all objects that have <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entries.) pg_attributeカタログにはテーブルの列情報が格納されます。 データベース内のすべてのテーブルの各列に対し必ず1つのpg_attribute行があります。 (また、インデックスとpg_classに項目を持つすべてのオブジェクトに対しての属性記述があります。)

The term attribute is equivalent to column and is used for historical reasons. 属性という表現は列と同等の意味で、歴史的背景からそのように呼ばれています。

表53.7 pg_attributeの列

<title><structname>pg_attribute</structname> Columns</title>

Column Type 列 型

Description 説明

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

The table this column belongs to この列が属するテーブル

attname name

The column name 列名

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

The data type of this column (zero for a dropped column) この列のデータ型(ゼロなら削除された列)

attlen int2

A copy of <literal>pg_type.typlen</literal> of this column's type この列の型のpg_type.typlenのコピー

attnum int2

The number of the column. Ordinary columns are numbered from 1 up. System columns, such as <structfield>ctid</structfield>, have (arbitrary) negative numbers. 列番号。 通常の列には1から始まる番号付けがなされます。 ctidのようなシステムによる列には(任意の)負の番号が付きます。

attcacheoff int4

Always -1 in storage, but when loaded into a row descriptor in memory this might be updated to cache the offset of the attribute within the row 格納時は必ず-1ですが、メモリ内の行記述子に読み込まれた場合は、行内での属性オフセットをキャッシュするために更新される可能性があります。

atttypmod int4

<structfield>atttypmod</structfield> records type-specific data supplied at table creation time (for example, the maximum length of a <type>varchar</type> column). It is passed to type-specific input functions and length coercion functions. The value will generally be -1 for types that do not need <structfield>atttypmod</structfield>. atttypmodは、テーブル作成時に与えられた型固有のデータ(たとえばvarchar列の最大長)を記録します。 これは型固有の入力関数や長さ強制関数に渡されます。 atttypmodを必要としない型では、通常、この値は-1です。

attndims int2

Number of dimensions, if the column is an array type; otherwise 0. (Presently, the number of dimensions of an array is not enforced, so any nonzero value effectively means <quote>it's an array</quote>.) 列が配列型の場合は次元数を表現し、そうでない時はゼロです。 (現在配列の次元数は強制されていませんのでゼロ以外のどのような値であってもこれは配列であるということを意味します。)

attbyval bool

A copy of <literal>pg_type.typbyval</literal> of this column's type この列の型のpg_type.typbyvalのコピー

attalign char

A copy of <literal>pg_type.typalign</literal> of this column's type この列の型のpg_type.typalignのコピー

attstorage char

Normally a copy of <literal>pg_type.typstorage</literal> of this column's type. For TOAST-able data types, this can be altered after column creation to control storage policy. 通常、この列の型のpg_type.typstorageのコピー。 TOAST可能なデータ型では、格納ポリシーを制御するために列の作成後に変更できます。

attcompression char

The current compression method of the column. Typically this is <literal>'\0'</literal> to specify use of the current default setting (see <xref linkend="guc-default-toast-compression"/>). Otherwise, <literal>'p'</literal> selects pglz compression, while <literal>'l'</literal> selects <productname>LZ4</productname> compression. However, this field is ignored whenever <structfield>attstorage</structfield> does not allow compression. この列の現在の圧縮方法。 典型的には現在のデフォルト設定(default_toast_compression参照)を指定する'\0'です。 そうでなければ、'p'はpglz圧縮を選択し、'l'LZ4圧縮を選択します。 ただし、attstorageが圧縮を許可しなければ、このフィールドは無視されます。

attnotnull bool

This represents a not-null constraint. 非NULL制約を表します。

atthasdef bool

This column has a default expression or generation expression, in which case there will be a corresponding entry in the <link linkend="catalog-pg-attrdef"><structname>pg_attrdef</structname></link> catalog that actually defines the expression. (Check <structfield>attgenerated</structfield> to determine whether this is a default or a generation expression.) この列にはデフォルト値あるいは生成式があります。 その場合、実際に値を定義するpg_attrdefカタログ内に対応する項目があります。 (これがデフォルトなのか生成式なのかはattgeneratedをチェックします。)

atthasmissing bool

This column has a value which is used where the column is entirely missing from the row, as happens when a column is added with a non-volatile <literal>DEFAULT</literal> value after the row is created. The actual value used is stored in the <structfield>attmissingval</structfield> column. この列は、行から列の値が完全に失われている場合に使われる値を持ちます。 これは、行が作られた後で非不安定(non-volatile)なDEFAULT値を持つ列が追加される際に起こります。 実際に使われる値はattmissingval列に格納されています。

attidentity char

If a zero byte (<literal>''</literal>), then not an identity column. Otherwise, <literal>a</literal> = generated always, <literal>d</literal> = generated by default. ゼロバイト('')ならこれはIDENTITY列ではありません。 IDENTITY列では、 a = GENERATED ALWAYS、 d = GENERATED BY DEFAULTになります。

attgenerated char

If a zero byte (<literal>''</literal>), then not a generated column. Otherwise, <literal>s</literal> = stored. (Other values might be added in the future.) ゼロバイト('')なら、生成列ではありません。 さもなければ s = storedです。 (将来他の値が追加されるかも知れません。)

attisdropped bool

This column has been dropped and is no longer valid. A dropped column is still physically present in the table, but is ignored by the parser and so cannot be accessed via SQL. この列は既に削除されていて有効ではありません。 削除された列は物理的にはまだテーブル上に存在していますが、パーサによって無視されるためSQLでアクセスできません。

attislocal bool

This column is defined locally in the relation. Note that a column can be locally defined and inherited simultaneously. この列はリレーション内でローカルに定義されます。 列がローカルに定義されると同時に継承される場合もあることに注意してください。

attinhcount int2

The number of direct ancestors this column has. A column with a nonzero number of ancestors cannot be dropped nor renamed. この列が持つ直接の祖先の数です。 祖先を持っている列の削除や名前は変更はできません。

attstattarget int2

<structfield>attstattarget</structfield> controls the level of detail of statistics accumulated for this column by <link linkend="sql-analyze"><command>ANALYZE</command></link>. A zero value indicates that no statistics should be collected. A negative value says to use the system default statistics target. The exact meaning of positive values is data type-dependent. For scalar data types, <structfield>attstattarget</structfield> is both the target number of <quote>most common values</quote> to collect, and the target number of histogram bins to create. attstattargetANALYZEによるこの列に対する蓄積された統計情報をどの程度詳しく管理するかを規定します。 値がゼロの場合は統計情報を収集しません。 負の値の場合は、システムのデフォルトの統計目標を使用すべきであるということです。 正の値が厳密に意味するところはデータ型に依存します。 スカラデータ型に対してattstattargetは収集する最も一般的な値の目標となる数であり、また作成するヒストグラムビンの目標数でもあります。

attcollation oid (references <link linkend="catalog-pg-collation"><structname>pg_collation</structname></link>.<structfield>oid</structfield>) (参照先 pg_collation.oid

The defined collation of the column, or zero if the column is not of a collatable data type 列で定義された照合順序。列が照合順序の設定ができないデータ型の場合はゼロ

attacl aclitem[]

Column-level access privileges, if any have been granted specifically on this column この列に特定して付与された場合における、列レベルのアクセス権限

attoptions text[]

Attribute-level options, as <quote>keyword=value</quote> strings keyword=value文字列のような、属性レベルのオプション

attfdwoptions text[]

Attribute-level foreign data wrapper options, as <quote>keyword=value</quote> strings keyword=value文字列のような、外部データラッパーオプションの属性レベル

attmissingval anyarray

This column has a one element array containing the value used when the column is entirely missing from the row, as happens when the column is added with a non-volatile <literal>DEFAULT</literal> value after the row is created. The value is only used when <structfield>atthasmissing</structfield> is true. If there is no value the column is null. この列は、行から列の値が完全に失われている場合に使われる値を持つ一要素配列を持ちます。 これは、行が作られた後で非不安定(non-volatile)なDEFAULT値を持つ列が追加される際に起こります。 この値はatthasmissingがtrueのときだけ使用されます。 値がなければその列はNULLになります。


In a dropped column's <structname>pg_attribute</structname> entry, <structfield>atttypid</structfield> is reset to zero, but <structfield>attlen</structfield> and the other fields copied from <link linkend="catalog-pg-type"><structname>pg_type</structname></link> are still valid. This arrangement is needed to cope with the situation where the dropped column's data type was later dropped, and so there is no <structname>pg_type</structname> row anymore. <structfield>attlen</structfield> and the other fields can be used to interpret the contents of a row of the table. 削除された列のpg_attribute項目では、atttypidはゼロにリセットされます。 しかしattlenpg_typeからコピーされた他のフィールドは、有効なままです。 この動作は、削除された列のデータ型が後になって削除されて、pg_type行が存在しないような状況の場合に必要です。 attlenと他のフィールドは、テーブル内の行の内容を解釈するために使用されます。