Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 415a9558429d583fc9b2617edd1d24a6 > files > 134

postgresql8.3-docs-8.3.8-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Pseudo-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.3.8 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="Data Types"
HREF="datatype.html"><LINK
REL="PREVIOUS"
TITLE="Object Identifier Types"
HREF="datatype-oid.html"><LINK
REL="NEXT"
TITLE="Functions and Operators"
HREF="functions.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="2009-09-04T05:13:45"></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.3.8 Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="datatype-oid.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="datatype.html"
>Fast Backward</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
>Chapter 8. Data Types</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="datatype.html"
>Fast Forward</A
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="functions.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="DATATYPE-PSEUDO"
>8.17. Pseudo-Types</A
></H1
><A
NAME="AEN6458"
></A
><A
NAME="AEN6460"
></A
><A
NAME="AEN6462"
></A
><A
NAME="AEN6464"
></A
><A
NAME="AEN6466"
></A
><A
NAME="AEN6468"
></A
><A
NAME="AEN6470"
></A
><A
NAME="AEN6472"
></A
><A
NAME="AEN6474"
></A
><A
NAME="AEN6476"
></A
><A
NAME="AEN6478"
></A
><A
NAME="AEN6480"
></A
><P
>    The <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> type system contains a
    number of special-purpose entries that are collectively called
    <I
CLASS="FIRSTTERM"
>pseudo-types</I
>.  A pseudo-type cannot be used as a
    column data type, but it can be used to declare a function's
    argument or result type.  Each of the available pseudo-types is
    useful in situations where a function's behavior does not
    correspond to simply taking or returning a value of a specific
    <ACRONYM
CLASS="ACRONYM"
>SQL</ACRONYM
> data type.  <A
HREF="datatype-pseudo.html#DATATYPE-PSEUDOTYPES-TABLE"
>Table 8-20</A
> lists the existing
    pseudo-types.
   </P
><DIV
CLASS="TABLE"
><A
NAME="DATATYPE-PSEUDOTYPES-TABLE"
></A
><P
><B
>Table 8-20. Pseudo-Types</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><THEAD
><TR
><TH
>Name</TH
><TH
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
><TT
CLASS="TYPE"
>any</TT
></TD
><TD
>Indicates that a function accepts any input data type whatever.</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>anyarray</TT
></TD
><TD
>Indicates that a function accepts any array data type
        (see <A
HREF="extend-type-system.html#EXTEND-TYPES-POLYMORPHIC"
>Section 34.2.5</A
>).</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>anyelement</TT
></TD
><TD
>Indicates that a function accepts any data type
        (see <A
HREF="extend-type-system.html#EXTEND-TYPES-POLYMORPHIC"
>Section 34.2.5</A
>).</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>anyenum</TT
></TD
><TD
>Indicates that a function accepts any enum data type
        (see <A
HREF="extend-type-system.html#EXTEND-TYPES-POLYMORPHIC"
>Section 34.2.5</A
> and
        <A
HREF="datatype-enum.html"
>Section 8.7</A
>).</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>anynonarray</TT
></TD
><TD
>Indicates that a function accepts any non-array data type
        (see <A
HREF="extend-type-system.html#EXTEND-TYPES-POLYMORPHIC"
>Section 34.2.5</A
>).</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>cstring</TT
></TD
><TD
>Indicates that a function accepts or returns a null-terminated C string.</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>internal</TT
></TD
><TD
>Indicates that a function accepts or returns a server-internal
        data type.</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>language_handler</TT
></TD
><TD
>A procedural language call handler is declared to return <TT
CLASS="TYPE"
>language_handler</TT
>.</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>record</TT
></TD
><TD
>Identifies a function returning an unspecified row type.</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>trigger</TT
></TD
><TD
>A trigger function is declared to return <TT
CLASS="TYPE"
>trigger.</TT
></TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>void</TT
></TD
><TD
>Indicates that a function returns no value.</TD
></TR
><TR
><TD
><TT
CLASS="TYPE"
>opaque</TT
></TD
><TD
>An obsolete type name that formerly served all the above purposes.</TD
></TR
></TBODY
></TABLE
></DIV
><P
>    Functions coded in C (whether built-in or dynamically loaded) can be
    declared to accept or return any of these pseudo data types.  It is up to
    the function author to ensure that the function will behave safely
    when a pseudo-type is used as an argument type.
   </P
><P
>    Functions coded in procedural languages can use pseudo-types only as
    allowed by their implementation languages.  At present the procedural
    languages all forbid use of a pseudo-type as argument type, and allow
    only <TT
CLASS="TYPE"
>void</TT
> and <TT
CLASS="TYPE"
>record</TT
> as a result type (plus
    <TT
CLASS="TYPE"
>trigger</TT
> when the function is used as a trigger).  Some also
    support polymorphic functions using the types <TT
CLASS="TYPE"
>anyarray</TT
>,
    <TT
CLASS="TYPE"
>anyelement</TT
>, <TT
CLASS="TYPE"
>anyenum</TT
>, and <TT
CLASS="TYPE"
>anynonarray</TT
>.
   </P
><P
>    The <TT
CLASS="TYPE"
>internal</TT
> pseudo-type is used to declare functions
    that are meant only to be called internally by the database
    system, and not by direct invocation in a <ACRONYM
CLASS="ACRONYM"
>SQL</ACRONYM
>
    query.  If a function has at least one <TT
CLASS="TYPE"
>internal</TT
>-type
    argument then it cannot be called from <ACRONYM
CLASS="ACRONYM"
>SQL</ACRONYM
>.  To
    preserve the type safety of this restriction it is important to
    follow this coding rule: do not create any function that is
    declared to return <TT
CLASS="TYPE"
>internal</TT
> unless it has at least one
    <TT
CLASS="TYPE"
>internal</TT
> argument.
   </P
></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="datatype-oid.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="functions.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Object Identifier Types</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="datatype.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Functions and Operators</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>