pg_type
#
The catalog <structname>pg_type</structname> stores information about data
types. Base types and enum types (scalar types) are created with
<link linkend="sql-createtype"><command>CREATE TYPE</command></link>, and
domains with
<link linkend="sql-createdomain"><command>CREATE DOMAIN</command></link>.
A composite type is automatically created for each table in the database, to
represent the row structure of the table. It is also possible to create
composite types with <command>CREATE TYPE AS</command>.
pg_type
カタログはデータ型の情報を保存します。
基本型と列挙型(スカラ型)はCREATE TYPE
で作成され、ドメインはCREATE DOMAIN
で作成されます。
複合型がテーブルの行構成を表すためデータベースの個々のテーブルに対して自動的に作成されます。
複合型をCREATE TYPE AS
で作成することもできます。
表51.64 pg_type
の列
Column Type 列 型 Description 説明 |
---|
Row identifier 行識別子 |
Data type name データ型名 |
The OID of the namespace that contains this type この型を含む名前空間のOID |
Owner of the type 型の所有者 |
For a fixed-size type, <structfield>typlen</structfield> is the number
of bytes in the internal representation of the type. But for a
variable-length type, <structfield>typlen</structfield> is negative.
-1 indicates a <quote>varlena</quote> type (one that has a length word),
-2 indicates a null-terminated C string.
固定長型では、 |
<structfield>typbyval</structfield> determines whether internal
routines pass a value of this type by value or by reference.
<structfield>typbyval</structfield> had better be false if
<structfield>typlen</structfield> is not 1, 2, or 4 (or 8 on machines
where Datum is 8 bytes).
Variable-length types are always passed by reference. Note that
<structfield>typbyval</structfield> can be false even if the
length would allow pass-by-value.
|
<structfield>typtype</structfield> is
<literal>b</literal> for a base type,
<literal>c</literal> for a composite type (e.g., a table's row type),
<literal>d</literal> for a domain,
<literal>e</literal> for an enum type,
<literal>p</literal> for a pseudo-type,
<literal>r</literal> for a range type, or
<literal>m</literal> for a multirange type.
See also <structfield>typrelid</structfield> and
<structfield>typbasetype</structfield>.
|
<structfield>typcategory</structfield> is an arbitrary classification
of data types that is used by the parser to determine which implicit
casts should be <quote>preferred</quote>.
See <xref linkend="catalog-typcategory-table"/>.
|
True if the type is a preferred cast target within its
<structfield>typcategory</structfield>
型が |
True if the type is defined, false if this is a placeholder
entry for a not-yet-defined type. When
<structfield>typisdefined</structfield> is false, nothing
except the type name, namespace, and OID can be relied on.
型が定義されている場合はtrue。
ここが未定義型に対する予備の場所である場合はfalse。
|
Character that separates two values of this type when parsing array input. Note that the delimiter is associated with the array element data type, not the array data type. 配列入力の構文解析をする際にこの型の2つの値を分離する文字。 区切り文字は配列データ型ではなく配列要素データ型に関連付けられることに注意してください。 |
If this is a composite type (see
<structfield>typtype</structfield>), then this column points to
the <link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry that defines the
corresponding table. (For a free-standing composite type, the
<link linkend="catalog-pg-class"><structname>pg_class</structname></link> entry doesn't really represent
a table, but it is needed anyway for the type's
<link linkend="catalog-pg-attribute"><structname>pg_attribute</structname></link> entries to link to.)
Zero for non-composite types.
もしこれが複合型( |
Subscripting handler function's OID, or zero if this type doesn't
support subscripting. Types that are <quote>true</quote> array
types have <structfield>typsubscript</structfield>
= <function>array_subscript_handler</function>, but other types may
have other handler functions to implement specialized subscripting
behavior.
添字ハンドラ関数のOID、あるいはこの型が添え字付けをサポートしていなければゼロ。
「本当の」配列型では、 |
If <structfield>typelem</structfield> is not zero then it
identifies another row in <structname>pg_type</structname>,
defining the type yielded by subscripting. This should be zero
if <structfield>typsubscript</structfield> is zero. However, it can
be zero when <structfield>typsubscript</structfield> isn't zero, if the
handler doesn't need <structfield>typelem</structfield> to
determine the subscripting result type.
Note that a <structfield>typelem</structfield> dependency is
considered to imply physical containment of the element type in
this type; so DDL changes on the element type might be restricted
by the presence of this type.
|
If <structfield>typarray</structfield> is not zero then it
identifies another row in <structname>pg_type</structname>, which
is the <quote>true</quote> array type having this type as element
|
Input conversion function (text format) 入力変換関数(テキスト形式) |
Output conversion function (text format) 出力変換関数(テキスト形式) |
Input conversion function (binary format), or zero if none 入力変換関数(バイナリ形式)、なければゼロ |
Output conversion function (binary format), or zero if none 出力変換関数(バイナリ形式)、なければゼロ |
Type modifier input function, or zero if type does not support modifiers 型修飾子の入力関数。型が修飾子をサポートしていない場合はゼロ |
Type modifier output function, or zero to use the standard format 型修飾子の出力関数。標準書式を使用する場合はゼロ |
Custom <xref linkend="sql-analyze"/> function, or zero to use the standard function 独自のANALYZE関数。標準関数を使用する場合はゼロ |
<structfield>typalign</structfield> is the alignment required
when storing a value of this type. It applies to storage on
disk as well as most representations of the value inside
<productname>PostgreSQL</productname>.
When multiple values are stored consecutively, such
as in the representation of a complete row on disk, padding is
inserted before a datum of this type so that it begins on the
specified boundary. The alignment reference is the beginning
of the first datum in the sequence.
Possible values are:
|
<structfield>typstorage</structfield> tells for varlena
types (those with <structfield>typlen</structfield> = -1) if
the type is prepared for toasting and what the default strategy
for attributes of this type should be.
Possible values are:
<literal>x</literal> is the usual choice for toast-able types.
Note that <literal>m</literal> values can also be moved out to
secondary storage, but only as a last resort (<literal>e</literal>
and <literal>x</literal> values are moved first).
トースト可能な型に対しては |
<structfield>typnotnull</structfield> represents a not-null
constraint on a type. Used for domains only.
|
If this is a domain (see <structfield>typtype</structfield>), then
<structfield>typbasetype</structfield> identifies the type that this
one is based on. Zero if this type is not a domain.
もしこれがドメイン( |
Domains use <structfield>typtypmod</structfield> to record the <literal>typmod</literal>
to be applied to their base type (-1 if base type does not use a
<literal>typmod</literal>). -1 if this type is not a domain.
ドメインは |
<structfield>typndims</structfield> is the number of array dimensions
for a domain over an array (that is, <structfield>typbasetype</structfield> is
an array type).
Zero for types other than domains over array types.
|
<structfield>typcollation</structfield> specifies the collation
of the type. If the type does not support collations, this will
be zero. A base type that supports collations will have a nonzero
value here, typically <symbol>DEFAULT_COLLATION_OID</symbol>.
A domain over a collatable type can have a collation OID different
from its base type's, if one was specified for the domain.
|
If <structfield>typdefaultbin</structfield> is not null, it is the
<function>nodeToString()</function>
representation of a default expression for the type. This is
only used for domains.
|
<structfield>typdefault</structfield> is null if the type has no associated
default value. If <structfield>typdefaultbin</structfield> is not null,
<structfield>typdefault</structfield> must contain a human-readable version of the
default expression represented by <structfield>typdefaultbin</structfield>. If
<structfield>typdefaultbin</structfield> is null and <structfield>typdefault</structfield> is
not, then <structfield>typdefault</structfield> is the external representation of
the type's default value, which can be fed to the type's input
converter to produce a constant.
関連するデフォルト値を持たない型であれば |
Access privileges; see <xref linkend="ddl-priv"/> for details アクセス権限。 詳細は5.8を参照してください |
For fixed-width types used in system tables, it is critical that the size
and alignment defined in <structname>pg_type</structname>
agree with the way that the compiler will lay out the column in
a structure representing a table row.
固定長型のシステムテーブルでは、pg_type
で定義されているサイズとアライメントと、コンパイラがテーブル行を表現する構造体の中で列を格納する方法とで合意が取れていることが重要です。
<xref linkend="catalog-typcategory-table"/> lists the system-defined values
of <structfield>typcategory</structfield>. Any future additions to this list will
also be upper-case ASCII letters. All other ASCII characters are reserved
for user-defined categories.
表 51.65はシステムで定義されたtypcategory
の値の一覧です。
今後この一覧に追加されるものは同様に大文字のASCII文字になります。
他のすべてのASCII文字はユーザ定義のカテゴリのために予約されています。
表51.65 typcategory
のコード
コード | カテゴリ |
---|---|
A | 配列型 |
B | 論理値型 |
C | 複合型 |
D | 日付時刻型 |
E | 列挙型 |
G | 幾何学型 |
I | ネットワークアドレス型 |
N | 数値型 |
P | 仮想型 |
R | 範囲型 |
S | 文字列型 |
T | 時間間隔型 |
U | ユーザ定義型 |
V | ビット列型 |
X | unknown 型 |
Z | 内部利用の型 |