<!-- $PostgreSQL: pgsql/doc/src/sgml/features.sgml,v 2.25 2006/09/16 00:30:13 momjian Exp $ -->

<appendix id="features">
 <title>SQL Conformance</title>

 <para>
  This section attempts to outline to what extent
  <productname>PostgreSQL</productname> conforms to the current SQL
  standard.  The following information is not a full statement of
  conformance, but it presents the main topics in as much detail as is
  both reasonable and useful for users.
 </para>

 <para>
  The formal name of the SQL standard is ISO/IEC 9075 <quote>Database
  Language SQL</quote>.  A revised version of the standard is released
  from time to time; the most recent one appearing in late 2003.  That
  version is referred to as ISO/IEC 9075:2003, or simply as SQL:2003.
  The versions prior to that were SQL:1999 and SQL-92.  Each version
  replaces the previous one, so claims of conformance to earlier
  versions have no official merit.
  <productname>PostgreSQL</productname> development aims for
  conformance with the latest official version of the standard where
  such conformance does not contradict traditional features or common
  sense.  The PostgreSQL project was not represented in the ISO/IEC
  9075 Working Group during the preparation of SQL:2003.  Even so,
  many of the features required by SQL:2003 are already supported,
  though sometimes with slightly differing syntax or function.
  Further moves towards conformance may be expected in later releases.
 </para>

 <para>
  <acronym>SQL-92</acronym> defined three feature sets for
  conformance: Entry, Intermediate, and Full.  Most database
  management systems claiming <acronym>SQL</acronym> standard
  conformance were conforming at only the Entry level, since the
  entire set of features in the Intermediate and Full levels was
  either too voluminous or in conflict with legacy behaviors.
 </para>

 <para>
  Starting with <acronym>SQL:1999</acronym>, the SQL standard defines
  a large set of individual features rather than the ineffectively
  broad three levels found in <acronym>SQL-92</acronym>.  A large
  subset of these features represents the <quote>Core</quote>
  features, which every conforming SQL implementation must supply.
  The rest of the features are purely optional.  Some optional
  features are grouped together to form <quote>packages</quote>, which
  SQL implementations can claim conformance to, thus claiming
  conformance to particular groups of features.
 </para>

 <para>
  The <acronym>SQL:2003</acronym> standard is also split into a number
  of parts.  Each is known by a shorthand name.  Note that these parts
  are not consecutively numbered.

  <itemizedlist>
   <listitem><para>ISO/IEC 9075-1 Framework (<acronym>SQL/Framework</acronym>)</para></listitem>
   <listitem><para>ISO/IEC 9075-2 Foundation (<acronym>SQL/Foundation</acronym>)</para></listitem>
   <listitem><para>ISO/IEC 9075-3 Call Level Interface (<acronym>SQL/CLI</acronym>)</para></listitem>
   <listitem><para>ISO/IEC 9075-4 Persistent Stored Modules (<acronym>SQL/PSM</acronym>)</para></listitem>
   <listitem><para>ISO/IEC 9075-9 Management of External Data (<acronym>SQL/MED</acronym>)</para></listitem>
   <listitem><para>ISO/IEC 9075-10 Object Language Bindings (<acronym>SQL/OLB</acronym>)</para></listitem>
   <listitem><para>ISO/IEC 9075-11 Information and Definition Schemas (<acronym>SQL/Schemata</acronym>)</para></listitem>
   <listitem><para>ISO/IEC 9075-13 Routines and Types using the Java Language (<acronym>SQL/JRT</acronym>)</para></listitem>
   <listitem><para>ISO/IEC 9075-14 XML-related specifications (<acronym>SQL/XML</acronym>)</para></listitem>
  </itemizedlist>
 </para>

 <para>
  <productname>PostgreSQL</productname> covers parts 1, 2, and 11.
  Part 3 is similar to the ODBC interface, and part 4 is similar to
  the <application>PL/pgSQL</application> programming language, but
  exact conformance is not specifically intended or verified in either
  case.
 </para>

 <para>
  PostgreSQL supports most of the major features of SQL:2003.  Out of
  164 mandatory features required for full Core conformance,
  PostgreSQL conforms to at least 150.  In addition, there is a long
  list of supported optional features.  It may be worth noting that at
  the time of writing, no current version of any database management
  system claims full conformance to Core SQL:2003.
 </para>

 <para>
  In the following two sections, we provide a list of those features
  that <productname>PostgreSQL</productname> supports, followed by a
  list of the features defined in <acronym>SQL:2003</acronym> which
  are not yet supported in <productname>PostgreSQL</productname>.
  Both of these lists are approximate: There may be minor details that
  are nonconforming for a feature that is listed as supported, and
  large parts of an unsupported feature may in fact be implemented.
  The main body of the documentation always contains the most accurate
  information about what does and does not work.
 </para>

 <note>
  <para>
   Feature codes containing a hyphen are subfeatures.  Therefore, if a
   particular subfeature is not supported, the main feature is listed
   as unsupported even if some other subfeatures are supported.
  </para>
 </note>

  <sect1 id="features-sql-standard">
   <title>Supported Features</title>

   <para>
    <informaltable>
     <tgroup cols="4">
      <thead>
       <row>
        <entry>Identifier</entry>
        <entry>Package</entry>
        <entry>Description</entry>
        <entry>Comment</entry>
       </row>
      </thead>

      &features-supported;

     </tgroup>
    </informaltable>
   </para>
  </sect1>

  <sect1 id="unsupported-features-sql-standard">
   <title>Unsupported Features</title>

   <para>
    The following features defined in <acronym>SQL:2003</acronym> are not
    implemented in this release of
    <productname>PostgreSQL</productname>. In a few cases, equivalent
    functionality is available.

    <informaltable>
     <tgroup cols="4">
      <thead>
       <row>
        <entry>Identifier</entry>
        <entry>Package</entry>
        <entry>Description</entry>
        <entry>Comment</entry>
       </row>
      </thead>

      &features-unsupported;

     </tgroup>
    </informaltable>
   </para>
  </sect1>

 </appendix>
