39.24. element_types
Представление element_types показывает дескрипторы типов элементов массива. Когда столбец таблицы, атрибут составного типа, параметр или результат функции объявлены с типом массива, соответствующее представление информационной схемы будет содержать только ARRAY в столбце data_type. Чтобы получить информацию о типе элемента массива, можно связать соответствующее представление с данным. Например, просмотреть столбцы таблицы с типами данных и типами элементов массива (если это применимо) можно так:
SELECT c.column_name, c.data_type, e.data_type AS element_type
FROM information_schema.columns c LEFT JOIN information_schema.element_types e
ON ((c.table_catalog, c.table_schema, c.table_name, 'TABLE', c.dtd_identifier)
= (e.object_catalog, e.object_schema, e.object_name, e.object_type, e.collection_type_identifier))
WHERE c.table_schema = '...' AND c.table_name = '...'
ORDER BY c.ordinal_position;Это представление показывает только те объекты, к которым имеет доступ текущий пользователь, являясь владельцем или имея некоторые права.
Таблица 39.22. Столбцы element_types
Тип столбца Описание |
|---|
Имя базы данных, содержащей объект, связанный с описываемым массивом (всегда текущая база) |
Имя схемы, содержащей объект, связанный с описываемым массивом |
Имя объекта, связанного с описываемым массивом |
Тип объекта, связанного с описываемым массивом: |
Идентификатор дескриптора типа данных для описываемого массива. Его можно использовать для соединения со столбцами |
Тип данных элементов массива, если это встроенный тип, либо |
Всегда NULL, так как эта информация неприменима к типам элементов массива в Postgres Pro |
Всегда NULL, так как эта информация неприменима к типам элементов массива в Postgres Pro |
Относится к функциональности, отсутствующей в Postgres Pro |
Относится к функциональности, отсутствующей в Postgres Pro |
Относится к функциональности, отсутствующей в Postgres Pro |
Имя базы данных, содержащей правило сортировки типа элемента (это всегда текущая база), либо NULL, если это правило по умолчанию или тип элемента несортируемый |
Имя схемы, содержащей правило сортировки типа элемента, либо NULL, если это правило по умолчанию или тип элемента несортируемый |
Имя правила сортировки типа элемента, либо NULL, если это правило по умолчанию или тип элемента несортируемый |
Всегда NULL, так как эта информация неприменима к типам элементов массива в Postgres Pro |
Всегда NULL, так как эта информация неприменима к типам элементов массива в Postgres Pro |
Всегда NULL, так как эта информация неприменима к типам элементов массива в Postgres Pro |
Всегда NULL, так как эта информация неприменима к типам элементов массива в Postgres Pro |
Всегда NULL, так как эта информация неприменима к типам элементов массива в Postgres Pro |
Всегда NULL, так как эта информация неприменима к типам элементов массива в Postgres Pro |
Ещё не реализовано |
Имя базы данных, в которой определён тип данных элемента (всегда текущая база) |
Имя схемы, в которой определён тип данных элемента |
Имя типа данных элемента |
Относится к функциональности, отсутствующей в Postgres Pro |
Относится к функциональности, отсутствующей в Postgres Pro |
Относится к функциональности, отсутствующей в Postgres Pro |
Всегда NULL, так как массивы имеют неограниченную максимальную ёмкость в Postgres Pro |
Идентификатор дескриптора типа данных элемента. В настоящее время бесполезен. |
39.24. element_types
The view element_types contains the data type descriptors of the elements of arrays. When a table column, composite-type attribute, domain, function parameter, or function return value is defined to be of an array type, the respective information schema view only contains ARRAY in the column data_type. To obtain information on the element type of the array, you can join the respective view with this view. For example, to show the columns of a table with data types and array element types, if applicable, you could do:
SELECT c.column_name, c.data_type, e.data_type AS element_type
FROM information_schema.columns c LEFT JOIN information_schema.element_types e
ON ((c.table_catalog, c.table_schema, c.table_name, 'TABLE', c.dtd_identifier)
= (e.object_catalog, e.object_schema, e.object_name, e.object_type, e.collection_type_identifier))
WHERE c.table_schema = '...' AND c.table_name = '...'
ORDER BY c.ordinal_position;
This view only includes objects that the current user has access to, by way of being the owner or having some privilege.
Table 39.22. element_types Columns
Column Type Description |
|---|
Name of the database that contains the object that uses the array being described (always the current database) |
Name of the schema that contains the object that uses the array being described |
Name of the object that uses the array being described |
The type of the object that uses the array being described: one of |
The identifier of the data type descriptor of the array being described. Use this to join with the |
Data type of the array elements, if it is a built-in type, else |
Always null, since this information is not applied to array element data types in Postgres Pro |
Always null, since this information is not applied to array element data types in Postgres Pro |
Applies to a feature not available in Postgres Pro |
Applies to a feature not available in Postgres Pro |
Applies to a feature not available in Postgres Pro |
Name of the database containing the collation of the element type (always the current database), null if default or the data type of the element is not collatable |
Name of the schema containing the collation of the element type, null if default or the data type of the element is not collatable |
Name of the collation of the element type, null if default or the data type of the element is not collatable |
Always null, since this information is not applied to array element data types in Postgres Pro |
Always null, since this information is not applied to array element data types in Postgres Pro |
Always null, since this information is not applied to array element data types in Postgres Pro |
Always null, since this information is not applied to array element data types in Postgres Pro |
Always null, since this information is not applied to array element data types in Postgres Pro |
Always null, since this information is not applied to array element data types in Postgres Pro |
Not yet implemented |
Name of the database that the data type of the elements is defined in (always the current database) |
Name of the schema that the data type of the elements is defined in |
Name of the data type of the elements |
Applies to a feature not available in Postgres Pro |
Applies to a feature not available in Postgres Pro |
Applies to a feature not available in Postgres Pro |
Always null, because arrays always have unlimited maximum cardinality in Postgres Pro |
An identifier of the data type descriptor of the element. This is currently not useful. |