<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >element_types</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REV="MADE" HREF="mailto:pgsql-docs@postgresql.org"><LINK REL="HOME" TITLE="PostgreSQL 8.0.11 Documentation" HREF="index.html"><LINK REL="UP" TITLE="The Information Schema" HREF="information-schema.html"><LINK REL="PREVIOUS" TITLE="domains" HREF="infoschema-domains.html"><LINK REL="NEXT" TITLE="enabled_roles" HREF="infoschema-enabled-roles.html"><LINK REL="STYLESHEET" TYPE="text/css" HREF="stylesheet.css"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1"><META NAME="creation" CONTENT="2007-02-02T03:57:22"></HEAD ><BODY CLASS="SECT1" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="5" ALIGN="center" VALIGN="bottom" >PostgreSQL 8.0.11 Documentation</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="infoschema-domains.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="information-schema.html" >Fast Backward</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" >Chapter 30. The Information Schema</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="top" ><A HREF="information-schema.html" >Fast Forward</A ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="top" ><A HREF="infoschema-enabled-roles.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="INFOSCHEMA-ELEMENT-TYPES" >30.16. <TT CLASS="LITERAL" >element_types</TT ></A ></H1 ><P > The view <TT CLASS="LITERAL" >element_types</TT > 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 <TT CLASS="LITERAL" >ARRAY</TT > in the column <TT CLASS="LITERAL" >data_type</TT >. 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 </P><PRE CLASS="PROGRAMLISTING" >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.array_type_identifier)) WHERE c.table_schema = '...' AND c.table_name = '...' ORDER BY c.ordinal_position;</PRE ><P> This view only includes objects that the current user has access to, by way of being the owner or having some privilege. </P ><DIV CLASS="TABLE" ><A NAME="AEN27010" ></A ><P ><B >Table 30-14. <TT CLASS="LITERAL" >element_types</TT > Columns</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Name</TH ><TH >Data Type</TH ><TH >Description</TH ></TR ></THEAD ><TBODY ><TR ><TD ><TT CLASS="LITERAL" >object_catalog</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD > Name of the database that contains the object that uses the array being described (always the current database) </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >object_schema</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD > Name of the schema that contains the object that uses the array being described </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >object_name</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD > Name of the object that uses the array being described </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >object_type</TT ></TD ><TD ><TT CLASS="TYPE" >character_data</TT ></TD ><TD > The type of the object that uses the array being described: one of <TT CLASS="LITERAL" >TABLE</TT > (the array is used by a column of that table), <TT CLASS="LITERAL" >DOMAIN</TT > (the array is used by that domain), <TT CLASS="LITERAL" >ROUTINE</TT > (the array is used by a parameter or the return data type of that function). </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >array_type_identifier</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD > The identifier of the data type descriptor of the array being described. Use this to join with the <TT CLASS="LITERAL" >dtd_identifier</TT > columns of other information schema views. </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >data_type</TT ></TD ><TD ><TT CLASS="TYPE" >character_data</TT ></TD ><TD > Data type of the array elements, if it is a built-in type, else <TT CLASS="LITERAL" >USER-DEFINED</TT > (in that case, the type is identified in <TT CLASS="LITERAL" >udt_name</TT > and associated columns). </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >character_maximum_length</TT ></TD ><TD ><TT CLASS="TYPE" >cardinal_number</TT ></TD ><TD >Always null, since this information is not applied to array element data types in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >character_octet_length</TT ></TD ><TD ><TT CLASS="TYPE" >cardinal_number</TT ></TD ><TD >Always null, since this information is not applied to array element data types in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >character_set_catalog</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >character_set_schema</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >character_set_name</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >collation_catalog</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >collation_schema</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >collation_name</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >numeric_precision</TT ></TD ><TD ><TT CLASS="TYPE" >cardinal_number</TT ></TD ><TD >Always null, since this information is not applied to array element data types in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >numeric_precision_radix</TT ></TD ><TD ><TT CLASS="TYPE" >cardinal_number</TT ></TD ><TD >Always null, since this information is not applied to array element data types in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >numeric_scale</TT ></TD ><TD ><TT CLASS="TYPE" >cardinal_number</TT ></TD ><TD >Always null, since this information is not applied to array element data types in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >datetime_precision</TT ></TD ><TD ><TT CLASS="TYPE" >cardinal_number</TT ></TD ><TD >Always null, since this information is not applied to array element data types in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >interval_type</TT ></TD ><TD ><TT CLASS="TYPE" >character_data</TT ></TD ><TD >Always null, since this information is not applied to array element data types in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >interval_precision</TT ></TD ><TD ><TT CLASS="TYPE" >character_data</TT ></TD ><TD >Always null, since this information is not applied to array element data types in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >domain_default</TT ></TD ><TD ><TT CLASS="TYPE" >character_data</TT ></TD ><TD >Not yet implemented</TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >udt_catalog</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD > Name of the database that the data type of the elements is defined in (always the current database) </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >udt_schema</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD > Name of the schema that the data type of the elements is defined in </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >udt_name</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD > Name of the data type of the elements </TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >scope_catalog</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >scope_schema</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >scope_name</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD >Applies to a feature not available in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >maximum_cardinality</TT ></TD ><TD ><TT CLASS="TYPE" >cardinal_number</TT ></TD ><TD >Always null, because arrays always have unlimited maximum cardinality in <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN ></TD ></TR ><TR ><TD ><TT CLASS="LITERAL" >dtd_identifier</TT ></TD ><TD ><TT CLASS="TYPE" >sql_identifier</TT ></TD ><TD > An identifier of the data type descriptor of the element. This is currently not useful. </TD ></TR ></TBODY ></TABLE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="infoschema-domains.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="infoschema-enabled-roles.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><TT CLASS="LITERAL" >domains</TT ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="information-schema.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><TT CLASS="LITERAL" >enabled_roles</TT ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >