📄 information_schema.sgml
字号:
<row> <entry><literal>domain_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Name of the schema that contains the domain</entry> </row> <row> <entry><literal>domain_name</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Name of the domain</entry> </row> </tbody> </tgroup> </table> </sect1> <sect1 id="infoschema-domains"> <title><literal>domains</literal></title> <para> The view <literal>domains</literal> contains all domains defined in the current database. </para> <table> <title><literal>domains</literal> Columns</title> <tgroup cols="3"> <thead> <row> <entry>Name</entry> <entry>Data Type</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><literal>domain_catalog</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Name of the database that contains the domain (always the current database)</entry> </row> <row> <entry><literal>domain_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Name of the schema that contains the domain</entry> </row> <row> <entry><literal>domain_name</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Name of the domain</entry> </row> <row> <entry><literal>data_type</literal></entry> <entry><type>character_data</type></entry> <entry> Data type of the domain, 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). </entry> </row> <row> <entry><literal>character_maximum_length</literal></entry> <entry><type>cardinal_number</type></entry> <entry> 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. </entry> </row> <row> <entry><literal>character_octet_length</literal></entry> <entry><type>cardinal_number</type></entry> <entry> If the domain has a character type, the maximum possible length in octets (bytes) of a datum (this should not be of concern to <productname>PostgreSQL</productname> users); null for all other data types. </entry> </row> <row> <entry><literal>character_set_catalog</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>character_set_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>character_set_name</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>collation_catalog</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>collation_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>collation_name</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>numeric_precision</literal></entry> <entry><type>cardinal_number</type></entry> <entry> If the domain has 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 may 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. </entry> </row> <row> <entry><literal>numeric_precision_radix</literal></entry> <entry><type>cardinal_number</type></entry> <entry> If the domain has 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. </entry> </row> <row> <entry><literal>numeric_scale</literal></entry> <entry><type>cardinal_number</type></entry> <entry> If the domain has 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 may 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. </entry> </row> <row> <entry><literal>datetime_precision</literal></entry> <entry><type>cardinal_number</type></entry> <entry> If the domain has a date, time, or interval type, the declared precision; null for all other data types or if no precision was declared. </entry> </row> <row> <entry><literal>interval_type</literal></entry> <entry><type>character_data</type></entry> <entry>Not yet implemented</entry> </row> <row> <entry><literal>interval_precision</literal></entry> <entry><type>character_data</type></entry> <entry>Not yet implemented</entry> </row> <row> <entry><literal>domain_default</literal></entry> <entry><type>character_data</type></entry> <entry>Default expression of the domain</entry> </row> <row> <entry><literal>udt_catalog</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Name of the database that the domain data type is defined in (always the current database)</entry> </row> <row> <entry><literal>udt_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Name of the schema that the domain data type is defined in</entry> </row> <row> <entry><literal>udt_name</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Name of the domain data type</entry> </row> <row> <entry><literal>scope_catalog</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>scope_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>scope_name</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>maximum_cardinality</literal></entry> <entry><type>cardinal_number</type></entry> <entry>Always null, because arrays always have unlimited maximum cardinality in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>dtd_identifier</literal></entry> <entry><type>sql_identifier</type></entry> <entry> 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.) </entry> </row> </tbody> </tgroup> </table> </sect1> <sect1 id="infoschema-element-types"> <title><literal>element_types</literal></title> <para> The view <literal>element_types</literal> contains the data type descriptors of the elements of arrays. When a table column, domain, function parameter, or function return value is defined to be of an array type, the respective information schema view only contains <literal>ARRAY</literal> in the column <literal>data_type</literal>. 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<programlisting>SELECT c.column_name, c.data_type, e.data_type AS element_typeFROM 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.array_type_identifier))WHERE c.table_schema = '...' AND c.table_name = '...'ORDER BY c.ordinal_position;</programlisting> This view only includes objects that the current user has access to, by way of being the owner or having some privilege. </para> <table> <title><literal>element_types</literal> Columns</title> <tgroup cols="3"> <thead> <row> <entry>Name</entry> <entry>Data Type</entry> <entry>Description</entry> </row> </thead> <tbody> <row> <entry><literal>object_catalog</literal></entry> <entry><type>sql_identifier</type></entry> <entry> Name of the database that contains the object that uses the array being described (always the current database) </entry> </row> <row> <entry><literal>object_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry> Name of the schema that contains the object that uses the array being described </entry> </row> <row> <entry><literal>object_name</literal></entry> <entry><type>sql_identifier</type></entry> <entry> Name of the object that uses the array being described </entry> </row> <row> <entry><literal>object_type</literal></entry> <entry><type>character_data</type></entry> <entry> The type of the object that uses the array being described: one of <literal>TABLE</literal> (the array is used by a column of that table), <literal>DOMAIN</literal> (the array is used by that domain), <literal>ROUTINE</literal> (the array is used by a parameter or the return data type of that function). </entry> </row> <row> <entry><literal>array_type_identifier</literal></entry> <entry><type>sql_identifier</type></entry> <entry> The identifier of the data type descriptor of the array being described. Use this to join with the <literal>dtd_identifier</literal> columns of other information schema views. </entry> </row> <row> <entry><literal>data_type</literal></entry> <entry><type>character_data</type></entry> <entry> Data type of the array elements, if it is a built-in type, else <literal>USER-DEFINED</literal> (in that case, the type is identified in <literal>udt_name</literal> and associated columns). </entry> </row> <row> <entry><literal>character_maximum_length</literal></entry> <entry><type>cardinal_number</type></entry> <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>character_octet_length</literal></entry> <entry><type>cardinal_number</type></entry> <entry>Always null, since this information is not applied to array element data types in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>character_set_catalog</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>character_set_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>character_set_name</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>collation_catalog</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>collation_schema</literal></entry> <entry><type>sql_identifier</type></entry> <entry>Applies to a feature not available in <productname>PostgreSQL</></entry> </row> <row> <entry><literal>collation_name</literal></entry>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -