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

37.17. columns #

The view <literal>columns</literal> contains information about all table columns (or view columns) in the database. System columns (<literal>ctid</literal>, etc.) are not included. Only those columns are shown that the current user has access to (by way of being the owner or having some privilege). columnsビューには、データベース内の全てのテーブル列(もしくはビューの列)についての情報が含まれます。 システム列(ctidなど)は含まれません。 現在のユーザが(所有者である、権限を持っているなどの方法で)アクセスできる列のみが示されます。

表37.15 columnsの列

<title><structname>columns</structname> Columns</title>

Column Type 列 型

Description 説明

table_catalog sql_identifier

Name of the database containing the table (always the current database) テーブルを持つデータベースの名前です(常に現在のデータベースです)。

table_schema sql_identifier

Name of the schema containing the table テーブルを持つスキーマの名前です。

table_name sql_identifier

Name of the table テーブルの名前です。

column_name sql_identifier

Name of the column 列の名前です。

ordinal_position cardinal_number

Ordinal position of the column within the table (count starts at 1) テーブル内の列の位置(1から始まる序数)です。

column_default character_data

Default expression of the column 列のデフォルト式です。

is_nullable yes_or_no

<literal>YES</literal> if the column is possibly nullable, <literal>NO</literal> if it is known not nullable. A not-null constraint is one way a column can be known not nullable, but there can be others. 列がNULLを持つことができる場合はYES、NULLを持つことができなければNOです。 非NULL制約は、列にNULLを持たせないようにする方法の1つですが、その他にも存在します。

data_type character_data

Data type of the column, if it is a built-in type, or <literal>ARRAY</literal> if it is some array (in that case, see the view <literal>element_types</literal>), else <literal>USER-DEFINED</literal> (in that case, the type is identified in <literal>udt_name</literal> and associated columns). If the column is based on a domain, this column refers to the type underlying the domain (and the domain is identified in <literal>domain_name</literal> and associated columns). 組み込み型の場合、列のデータ型、配列の場合、ARRAY(この場合はelement_typesビューを参照してください)、さもなくば、USER-DEFINEDです(この場合、型はudt_nameと関連する列で識別されます)。 列がドメインに基づくものであれば、その列はドメインの背後にある型を示します (そして、ドメインはdomain_nameと関連する列によって識別されます)。

character_maximum_length cardinal_number

If <literal>data_type</literal> identifies a character or bit string type, the declared maximum length; null for all other data types or if no maximum length was declared. data_typeが文字列またはビット列と識別される場合、その宣言された最大長です。 他のデータ型または最大長が宣言されていない場合はNULLです。

character_octet_length cardinal_number

If <literal>data_type</literal> identifies a character type, the maximum possible length in octets (bytes) of a datum; null for all other data types. The maximum octet length depends on the declared character maximum length (see above) and the server encoding. data_typeが文字列と識別される場合、オクテット(バイト)単位で表したデータの最大長です。 他のデータ型ではNULLです。 最大オクテット長は宣言された文字最大長(上述)とサーバ符号化方式に依存します。

numeric_precision cardinal_number

If <literal>data_type</literal> identifies a numeric type, this column contains the (declared or implicit) precision of the type for this column. The precision indicates the number of significant digits. It can be expressed in decimal (base 10) or binary (base 2) terms, as specified in the column <literal>numeric_precision_radix</literal>. For all other data types, this column is null. data_typeが数値型と識別される場合、ここには、その列の型の(宣言された、もしくは暗黙的な)精度が含まれます。 この精度は有意な桁数を示します。 numeric_precision_radix列の指定に従い、10進数(10を底)、もしくは2進数(2を底)で表現されます。 他の全ての型の場合では、この列はNULLです。

numeric_precision_radix cardinal_number

If <literal>data_type</literal> identifies a numeric type, this column indicates in which base the values in the columns <literal>numeric_precision</literal> and <literal>numeric_scale</literal> are expressed. The value is either 2 or 10. For all other data types, this column is null. data_typeが数値型と識別される場合、この列は、numeric_precisionおよびnumeric_scaleで表現される値の基が何かを示します。 この値は2または10です。 他の全ての型の場合では、この列はNULLです。

numeric_scale cardinal_number

If <literal>data_type</literal> identifies an exact numeric type, this column contains the (declared or implicit) scale of the type for this column. The scale indicates the number of significant digits to the right of the decimal point. It can be expressed in decimal (base 10) or binary (base 2) terms, as specified in the column <literal>numeric_precision_radix</literal>. For all other data types, this column is null. data_typeが高精度数値型と識別される場合、ここには、その列の型の(宣言された、あるいは暗黙的な)位取りが含まれます。 位取りとは、小数点より右側の有意な桁数です。 numeric_precision_radix列の指定に従い、10進数(10を底)、もしくは2進数(2を底)で表現されます。 他の全ての型の場合では、この列はNULLです。

datetime_precision cardinal_number

If <literal>data_type</literal> identifies a date, time, timestamp, or interval type, this column contains the (declared or implicit) fractional seconds precision of the type for this column, that is, the number of decimal digits maintained following the decimal point in the seconds value. For all other data types, this column is null. data_typeが日付、時刻、タイムスタンプ、間隔型と識別される場合、この列の型の秒以下の(宣言された、または暗黙的な)精度、つまり、秒値の小数点以降に保持する10進桁数、です。 他の全ての型の場合では、この列はNULLです。

interval_type character_data

If <literal>data_type</literal> identifies an interval type, this column contains the specification which fields the intervals include for this column, e.g., <literal>YEAR TO MONTH</literal>, <literal>DAY TO SECOND</literal>, etc. If no field restrictions were specified (that is, the interval accepts all fields), and for all other data types, this field is null. data_typeが時間間隔型と識別される場合、この列はこの属性の時間間隔値がどのフィールドを含むかの仕様を含みます。例えば、YEAR TO MONTHDAY TO SECONDなどです。 もしフィールド制約が指定されていない(時間間隔が全てのフィールドを受け付ける)場合や、他の全てのデータ型の場合はこのフィールドはNULLです。

interval_precision cardinal_number

Applies to a feature not available in <productname>PostgreSQL</productname> (see <literal>datetime_precision</literal> for the fractional seconds precision of interval type columns) PostgreSQLで利用できない機能に適用されるものです。(時間間隔型の属性の秒未満の精度についてはdatetime_precisionを参照してください)

character_set_catalog sql_identifier

Applies to a feature not available in <productname>PostgreSQL</productname> PostgreSQLでは利用できない機能に適用されるものです。

character_set_schema sql_identifier

Applies to a feature not available in <productname>PostgreSQL</productname> PostgreSQLでは利用できない機能に適用されるものです。

character_set_name sql_identifier

Applies to a feature not available in <productname>PostgreSQL</productname> PostgreSQLでは利用できない機能に適用されるものです。

collation_catalog sql_identifier

Name of the database containing the collation of the column (always the current database), null if default or the data type of the column is not collatable 列の照合を含むデータベース(常に現在のデータベース)の名前で、デフォルトであるか属性のデータ型が照合可能でない場合はNULLです。

collation_schema sql_identifier

Name of the schema containing the collation of the column, null if default or the data type of the column is not collatable 属性の照合を含むスキーマの名前で、デフォルトであるか属性のデータ型が照合可能でない場合はNULLです。

collation_name sql_identifier

Name of the collation of the column, null if default or the data type of the column is not collatable 列の照合の名前で、デフォルトであるか列のデータ型が照合可能でない場合はNULLです。

domain_catalog sql_identifier

If the column has a domain type, the name of the database that the domain is defined in (always the current database), else null. 列がドメイン型の場合、そのドメインを定義したデータベースの名前です (常に現在のデータベースです)。 さもなくば、NULLです。

domain_schema sql_identifier

If the column has a domain type, the name of the schema that the domain is defined in, else null. 列がドメイン型の場合、そのドメインを定義したスキーマの名前です。 さもなくば、NULLです。

domain_name sql_identifier

If the column has a domain type, the name of the domain, else null. 列がドメイン型の場合、そのドメインの名前です。 さもなくば、NULLです。

udt_catalog sql_identifier

Name of the database that the column data type (the underlying type of the domain, if applicable) is defined in (always the current database) 列データ型(もし適用されていたら背後にあるドメインの型)を定義したデータベースの名前です(常に現在のデータベースです)。

udt_schema sql_identifier

Name of the schema that the column data type (the underlying type of the domain, if applicable) is defined in 列データ型(もし適用されていたら背後にあるドメインの型)を定義したスキーマの名前です。

udt_name sql_identifier

Name of the column data type (the underlying type of the domain, if applicable) 列データ型(もし適用されていたら背後にあるドメインの型)の名前です。

scope_catalog sql_identifier

Applies to a feature not available in <productname>PostgreSQL</productname> PostgreSQLでは利用できない機能に適用されるものです。

scope_schema sql_identifier

Applies to a feature not available in <productname>PostgreSQL</productname> PostgreSQLでは利用できない機能に適用されるものです。

scope_name sql_identifier

Applies to a feature not available in <productname>PostgreSQL</productname> PostgreSQLでは利用できない機能に適用されるものです。

maximum_cardinality cardinal_number

Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</productname> 常にNULLです。PostgreSQLでは配列の次数は無制限だからです。

dtd_identifier sql_identifier

An identifier of the data type descriptor of the column, unique among the data type descriptors pertaining to the table. This is mainly useful for joining with other instances of such identifiers. (The specific format of the identifier is not defined and not guaranteed to remain the same in future versions.) 列のデータ型記述子の、テーブルに属するデータ型記述子内で一意な識別子です。 この識別子のインスタンスを結合する時に、主に有用です。 (識別子の書式仕様は定義されておらず、今後のバージョンで同一性を維持する保証もありません。)

is_self_referencing yes_or_no

Applies to a feature not available in <productname>PostgreSQL</productname> PostgreSQLでは利用できない機能に適用されるものです。

is_identity yes_or_no

If the column is an identity column, then <literal>YES</literal>, else <literal>NO</literal>. 列が識別列であればYES、そうでなければNOです。

identity_generation character_data

If the column is an identity column, then <literal>ALWAYS</literal> or <literal>BY DEFAULT</literal>, reflecting the definition of the column. 列が識別列であれば、列の定義を反映してALWAYSまたはBY DEFAULTです。

identity_start character_data

If the column is an identity column, then the start value of the internal sequence, else null. 列が識別列であれば内部シーケンスの開始値、そうでなければNULLです。

identity_increment character_data

If the column is an identity column, then the increment of the internal sequence, else null. 列が識別列であれば内部シーケンスの増分、そうでなければNULLです。

identity_maximum character_data

If the column is an identity column, then the maximum value of the internal sequence, else null. 列が識別列であれば内部シーケンスの最大値、そうでなければNULLです。

identity_minimum character_data

If the column is an identity column, then the minimum value of the internal sequence, else null. 列が識別列であれば内部シーケンスの最小値、そうでなければNULLです。

identity_cycle yes_or_no

If the column is an identity column, then <literal>YES</literal> if the internal sequence cycles or <literal>NO</literal> if it does not; otherwise null. 列が識別列であれば、内部シーケンスが周回する場合にYES、周回しない場合にNO、識別列でなければNULLです。

is_generated character_data

If the column is a generated column, then <literal>ALWAYS</literal>, else <literal>NEVER</literal>. 列が生成された列であればALWAYS、そうでなければNEVERです。

generation_expression character_data

If the column is a generated column, then the generation expression, else null. 列が生成された列であれば生成式、そうでなければNULLです。

is_updatable yes_or_no

<literal>YES</literal> if the column is updatable, <literal>NO</literal> if not (Columns in base tables are always updatable, columns in views not necessarily) 列が更新可能な場合YES、さもなくばNOです。 (ベーステーブルの列は常に更新可能です。ビューの列では不要です。)


Since data types can be defined in a variety of ways in SQL, and <productname>PostgreSQL</productname> contains additional ways to define data types, their representation in the information schema can be somewhat difficult. The column <literal>data_type</literal> is supposed to identify the underlying built-in type of the column. In <productname>PostgreSQL</productname>, this means that the type is defined in the system catalog schema <literal>pg_catalog</literal>. This column might be useful if the application can handle the well-known built-in types specially (for example, format the numeric types differently or use the data in the precision columns). The columns <literal>udt_name</literal>, <literal>udt_schema</literal>, and <literal>udt_catalog</literal> always identify the underlying data type of the column, even if the column is based on a domain. (Since <productname>PostgreSQL</productname> treats built-in types like user-defined types, built-in types appear here as well. This is an extension of the SQL standard.) These columns should be used if an application wants to process data differently according to the type, because in that case it wouldn't matter if the column is really based on a domain. If the column is based on a domain, the identity of the domain is stored in the columns <literal>domain_name</literal>, <literal>domain_schema</literal>, and <literal>domain_catalog</literal>. If you want to pair up columns with their associated data types and treat domains as separate types, you could write <literal>coalesce(domain_name, udt_name)</literal>, etc. データ型は、複数の方法でSQLにより定義でき、さらにPostgreSQLにはデータ型定義に別の方法も追加されていますので、情報スキーマにおけるデータ型表現は多少難しくなっています。 data_type列は、列の背後にある組み込み型を識別できるようになっていなければなりません。 PostgreSQLでは、型がpg_catalogシステムカタログスキーマで定義されていることを意味します。 よく知られた組み込み型を特別に扱うことができるアプリケーション(例えば、数値型を異なる書式にする、精度列内のデータを使用する)の場合、この列が有用な場合があります。 udt_nameudt_schemaudt_catalog列は、たとえドメインに基づいた列であっても、常に列の背後にあるデータ型を識別します (PostgreSQLは、組み込み型をユーザ定義型と同様に扱いますので、ここには組み込み型も現れます。これは標準SQLからの拡張です)。 アプリケーションが型に従って異なる処理を行う場合、これらの列を使用しなければなりません。 このような場合、本当はドメインに基づいている列なのかどうかが関係ないからです。 列がドメインに基づく場合、ドメインの識別子はdomain_namedomain_schemadomain_catalog列に保持されます。 関連するデータ型と列の組み合わせを作りたい場合や、ドメインを別の型として扱いたい場合は、coalesce(domain_name, udt_name)などとすることができます。