<quote>stand-alone</quote> composite type with no associated
table. A composite type is simply a list of types with
associated field names. A value of a composite type is a row or
record of field values. Refer to <xref linkend="rowtypes"/>
for more information.
</para>
<para>
A range type can hold two values of the same type, which are the lower
and upper bounds of the range. Range types are user-created, although
a few built-in ones exist. Refer to <xref linkend="rangetypes"/>
for more information.
</para>
</sect2>
<sect2 id="extend-type-system-domains">
<title>Domains</title>
<para>
A domain is based on a particular underlying type and for many purposes
is interchangeable with its underlying type. However, a domain can have
constraints that restrict its valid values to a subset of what the
underlying type would allow. Domains are created using
the <acronym>SQL</acronym> command <xref linkend="sql-createdomain"/>.
Refer to <xref linkend="domains"/> for more information.
</para>
</sect2>
<sect2 id="extend-type-system-pseudo">
<title>Pseudo-Types</title>
<para>
There are a few <quote>pseudo-types</quote> for special purposes.
Pseudo-types cannot appear as columns of tables or components of
container types, but they can be used to declare the argument and
result types of functions. This provides a mechanism within the
type system to identify special classes of functions. <xref
linkend="datatype-pseudotypes-table"/> lists the existing
pseudo-types.
</para>
</sect2>
<sect2 id="extend-types-polymorphic">
<title>Polymorphic Types</title>
<indexterm zone="extend-types-polymorphic">
<primary>polymorphic type</primary>
</indexterm>
<indexterm zone="extend-types-polymorphic">
<primary>polymorphic function</primary>
</indexterm>
<indexterm zone="extend-types-polymorphic">
<primary>data type</primary>
<secondary>polymorphic</secondary>
</indexterm>
<indexterm zone="extend-types-polymorphic">
<primary>function</primary>
<secondary>polymorphic</secondary>
</indexterm>
<para>
Some pseudo-types of special interest are the <firstterm>polymorphic
types</firstterm>, which are used to declare <firstterm>polymorphic
functions</firstterm>. This powerful feature allows a single function
definition to operate on many different data types, with the specific
data type(s) being determined by the data types actually passed to it
in a particular call. The polymorphic types are shown in
<xref linkend="extend-types-polymorphic-table"/>. Some examples of
their use appear in <xref linkend="xfunc-sql-polymorphic-functions"/>.
</para>
<table id="extend-types-polymorphic-table">
<title>Polymorphic Types</title>
<tgroup cols="3">
<colspec colname="col1" colwidth="2*"/>
<colspec colname="col2" colwidth="1*"/>
<colspec colname="col3" colwidth="2*"/>
<thead>
<row>
<entry>Name</entry>
<entry>Family</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><type>anyelement</type></entry>
<entry>Simple</entry>
<entry>Indicates that a function accepts any data type</entry>
</row>
<row>
<entry><type>anyarray</type></entry>
<entry>Simple</entry>
<entry>Indicates that a function accepts any array data type</entry>
</row>
<row>
<entry><type>anynonarray</type></entry>
<entry>Simple</entry>
<entry>Indicates that a function accepts any non-array data type</entry>
</row>
<row>
<entry><type>anyenum</type></entry>
<entry>Simple</entry>
<entry>Indicates that a function accepts any enum data type
(see <xref linkend="datatype-enum"/>)
</entry>