36.23. domains
Представление domains показывает все домены, определённые в текущей базе данных. В нём показываются только те домены, к которым имеет доступ текущий пользователь (являясь владельцем или имея некоторые права).
Таблица 36.21. Столбцы domains
| Имя | Тип данных | Описание |
|---|---|---|
domain_catalog | sql_identifier | Имя базы данных, содержащей домен (всегда текущая база) |
domain_schema | sql_identifier | Имя схемы, содержащей домен |
domain_name | sql_identifier | Имя домена |
data_type | character_data | Тип данных домена, если это встроенный тип, либо ARRAY, если это массив (в этом случае обратитесь к представлению element_types), иначе — USER-DEFINED (в этом случае тип определяется в udt_name и связанных столбцах). |
character_maximum_length | cardinal_number | Если домен имеет тип текстовой или битовой строки, это поле задаёт её объявленную максимальную длину; NULL для всех других типов данных, или если максимальная длина не объявлена. |
character_octet_length | cardinal_number | Если домен имеет тип символьной строки, это поле задаёт её максимально возможный размер в октетах (байтах); NULL для всех других типов данных. Максимальный размер в октетах зависит от объявленной максимальной длины в символах (см. выше) и от кодировки сервера. |
character_set_catalog | sql_identifier | Относится к функциональности, отсутствующей в PostgreSQL |
character_set_schema | sql_identifier | Относится к функциональности, отсутствующей в PostgreSQL |
character_set_name | sql_identifier | Относится к функциональности, отсутствующей в PostgreSQL |
collation_catalog | sql_identifier | Имя базы данных, содержащей правило сортировки домена (это всегда текущая база), либо NULL, если это правило по умолчанию или тип домена несортируемый |
collation_schema | sql_identifier | Имя схемы, содержащей правило сортировки домена, либо NULL, если это правило по умолчанию или тип домена несортируемый |
collation_name | sql_identifier | Имя правила сортировки домена, либо NULL, если это правило по умолчанию или тип домена несортируемый |
numeric_precision | cardinal_number | Если домен имеет числовой тип, этот столбец содержит точность (объявленную или неявную) типа для этого домена. Точность определяет число значащих цифр. Она может выражаться в десятичных (по основанию 10) или двоичных (по основанию 2) цифрах, согласно столбцу numeric_precision_radix. Для всех других типов данных этот столбец содержит NULL. |
numeric_precision_radix | cardinal_number | Если домен имеет числовой тип, в этом столбце определяется, по какому основанию задаются значения в столбцах numeric_precision и numeric_scale. Возможные варианты: 2 и 10. Для всех других типов данных этот столбец содержит NULL. |
numeric_scale | cardinal_number | Если домен имеет точный числовой тип, этот столбец содержит масштаб (объявленный или неявный) типа для этого домена. Масштаб определяет число значащих цифр справа от десятичной точки. Он может выражаться в десятичных (по основанию 10) или двоичных (по основанию 2) цифрах, согласно столбцу numeric_precision_radix. Для всех других типов данных этот столбец содержит NULL. |
datetime_precision | cardinal_number | Если в data_type указан тип даты, времени, отметки времени или интервала, этот столбец содержит точность (объявленную или неявную) в долях секунды типа для этого домена, то есть число десятичных цифр, сохраняемых после десятичной точки в значении секунд. Для всех других типов данных этот столбец содержит NULL. |
interval_type | character_data | Если в data_type указан тип интервала, этот столбец определяет, какие поля принимает интервал в домене, например: YEAR TO MONTH, DAY TO SECOND и т. д. Если ограничения для полей не заданы (то есть, интервал принимает все поля), и для любых других типов данных это поле содержит NULL. |
interval_precision | cardinal_number | Относится к функциональности, отсутствующей в PostgreSQL (см. поле datetime_precision, определяющее точность в долях секунды для типов интервалов) |
domain_default | character_data | Выражение по умолчанию для домена |
udt_catalog | sql_identifier | Имя базы данных, в которой определён тип данных домена (всегда текущая база) |
udt_schema | sql_identifier | Имя схемы, в которой определён тип данных домена |
udt_name | sql_identifier | Имя типа данных домена |
scope_catalog | sql_identifier | Относится к функциональности, отсутствующей в PostgreSQL |
scope_schema | sql_identifier | Относится к функциональности, отсутствующей в PostgreSQL |
scope_name | sql_identifier | Относится к функциональности, отсутствующей в PostgreSQL |
maximum_cardinality | cardinal_number | Всегда NULL, так как массивы имеют неограниченную максимальную ёмкость в PostgreSQL |
dtd_identifier | sql_identifier | Идентификатор дескриптора типа данных целевого домена, уникальный среди всех дескрипторов типов, относящихся к домену (что тривиально, так как домен содержит только один дескриптор типа). Он в основном полезен для соединения с другими экземплярами таких идентификаторов. (Конкретный формат идентификатора не определён и не гарантируется, что он останется неизменным в будущих версиях.) |
36.23. domains
The view domains contains all domains defined in the current database. Only those domains are shown that the current user has access to (by way of being the owner or having some privilege).
Table 36.21. domains Columns
| Name | Data Type | Description |
|---|---|---|
domain_catalog | sql_identifier | Name of the database that contains the domain (always the current database) |
domain_schema | sql_identifier | Name of the schema that contains the domain |
domain_name | sql_identifier | Name of the domain |
data_type | character_data | Data type of the domain, if it is a built-in type, or ARRAY if it is some array (in that case, see the view element_types), else USER-DEFINED (in that case, the type is identified in udt_name and associated columns). |
character_maximum_length | cardinal_number | If the domain has a character or bit string type, the declared maximum length; null for all other data types or if no maximum length was declared. |
character_octet_length | cardinal_number | If the domain has 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. |
character_set_catalog | sql_identifier | Applies to a feature not available in PostgreSQL |
character_set_schema | sql_identifier | Applies to a feature not available in PostgreSQL |
character_set_name | sql_identifier | Applies to a feature not available in PostgreSQL |
collation_catalog | sql_identifier | Name of the database containing the collation of the domain (always the current database), null if default or the data type of the domain is not collatable |
collation_schema | sql_identifier | Name of the schema containing the collation of the domain, null if default or the data type of the domain is not collatable |
collation_name | sql_identifier | Name of the collation of the domain, null if default or the data type of the domain is not collatable |
numeric_precision | cardinal_number | If the domain has a numeric type, this column contains the (declared or implicit) precision of the type for this domain. 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 numeric_precision_radix. For all other data types, this column is null. |
numeric_precision_radix | cardinal_number | If the domain has a numeric type, this column indicates in which base the values in the columns numeric_precision and numeric_scale are expressed. The value is either 2 or 10. For all other data types, this column is null. |
numeric_scale | cardinal_number | If the domain has an exact numeric type, this column contains the (declared or implicit) scale of the type for this domain. 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 numeric_precision_radix. For all other data types, this column is null. |
datetime_precision | cardinal_number | If data_type identifies a date, time, timestamp, or interval type, this column contains the (declared or implicit) fractional seconds precision of the type for this domain, 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. |
interval_type | character_data | If data_type identifies an interval type, this column contains the specification which fields the intervals include for this domain, e.g., YEAR TO MONTH, DAY TO SECOND, etc. If no field restrictions were specified (that is, the interval accepts all fields), and for all other data types, this field is null. |
interval_precision | cardinal_number | Applies to a feature not available in PostgreSQL (see datetime_precision for the fractional seconds precision of interval type domains) |
domain_default | character_data | Default expression of the domain |
udt_catalog | sql_identifier | Name of the database that the domain data type is defined in (always the current database) |
udt_schema | sql_identifier | Name of the schema that the domain data type is defined in |
udt_name | sql_identifier | Name of the domain data type |
scope_catalog | sql_identifier | Applies to a feature not available in PostgreSQL |
scope_schema | sql_identifier | Applies to a feature not available in PostgreSQL |
scope_name | sql_identifier | Applies to a feature not available in PostgreSQL |
maximum_cardinality | cardinal_number | Always null, because arrays always have unlimited maximum cardinality in PostgreSQL |
dtd_identifier | sql_identifier | An identifier of the data type descriptor of the domain, unique among the data type descriptors pertaining to the domain (which is trivial, because a domain only contains one data type descriptor). 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.) |