Home Explore Blog Models CI



postgresql

38th chunk of `doc/src/sgml/ref/create_table.sgml`
2f4a51f5f39e855b461d03af10f5f842120a642f7e410dd10000000100000e5b
 supported by
    <productname>PostgreSQL</productname>.
   </para>
  </refsect2>

  <refsect2>
   <title>Zero-Column Tables</title>

   <para>
    <productname>PostgreSQL</productname> allows a table of no columns
    to be created (for example, <literal>CREATE TABLE foo();</literal>).  This
    is an extension from the SQL standard, which does not allow zero-column
    tables.  Zero-column tables are not in themselves very useful, but
    disallowing them creates odd special cases for <command>ALTER TABLE
    DROP COLUMN</command>, so it seems cleaner to ignore this spec restriction.
   </para>
  </refsect2>

  <refsect2>
   <title>Multiple Identity Columns</title>

   <para>
    <productname>PostgreSQL</productname> allows a table to have more than one
    identity column.  The standard specifies that a table can have at most one
    identity column.  This is relaxed mainly to give more flexibility for
    doing schema changes or migrations.  Note that
    the <command>INSERT</command> command supports only one override clause
    that applies to the entire statement, so having multiple identity columns
    with different behaviors is not well supported.
   </para>
  </refsect2>

  <refsect2>
   <title>Generated Columns</title>

   <para>
    The options <literal>STORED</literal> and <literal>VIRTUAL</literal> are
    not standard but are also used by other SQL implementations.  The SQL
    standard does not specify the storage of generated columns.
   </para>
  </refsect2>

  <refsect2>
   <title><literal>LIKE</literal> Clause</title>

   <para>
    While a <literal>LIKE</literal> clause exists in the SQL standard, many of the
    options that <productname>PostgreSQL</productname> accepts for it are not
    in the standard, and some of the standard's options are not implemented
    by <productname>PostgreSQL</productname>.
   </para>
  </refsect2>

  <refsect2>
   <title><literal>WITH</literal> Clause</title>

   <para>
    The <literal>WITH</literal> clause is a <productname>PostgreSQL</productname>
    extension; storage parameters are not in the standard.
   </para>
  </refsect2>

  <refsect2>
   <title>Tablespaces</title>

   <para>
    The <productname>PostgreSQL</productname> concept of tablespaces is not
    part of the standard.  Hence, the clauses <literal>TABLESPACE</literal>
    and <literal>USING INDEX TABLESPACE</literal> are extensions.
   </para>
  </refsect2>

  <refsect2>
   <title>Typed Tables</title>

   <para>
    Typed tables implement a subset of the SQL standard.  According to
    the standard, a typed table has columns corresponding to the
    underlying composite type as well as one other column that is
    the <quote>self-referencing column</quote>.
    <productname>PostgreSQL</productname> does not support self-referencing
    columns explicitly.
   </para>
  </refsect2>

  <refsect2>
   <title><literal>PARTITION BY</literal> Clause</title>

   <para>
    The <literal>PARTITION BY</literal> clause is a
    <productname>PostgreSQL</productname> extension.
   </para>
  </refsect2>

  <refsect2>
   <title><literal>PARTITION OF</literal> Clause</title>

   <para>
    The <literal>PARTITION OF</literal> clause is a
    <productname>PostgreSQL</productname> extension.
   </para>
  </refsect2>

 </refsect1>


 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-altertable"/></member>
   <member><xref linkend="sql-droptable"/></member>
   <member><xref linkend="sql-createtableas"/></member>
   <member><xref linkend="sql-createtablespace"/></member>
   <member><xref linkend="sql-createtype"/></member>
  </simplelist>
 </refsect1>
</refentry>

Title: CREATE TABLE Compatibility: Identity Columns, Generated Columns, LIKE Clause, and Other Extensions
Summary
This section continues detailing the compatibility aspects of the CREATE TABLE command in PostgreSQL with the SQL standard. It covers the allowance of multiple identity columns in PostgreSQL, discusses the non-standard options for generated columns, highlights the differences in the LIKE clause, and notes the WITH clause and tablespaces as PostgreSQL extensions. Lastly, it points out the partial implementation of typed tables and notes the partition related clauses PARTITION BY and PARTITION OF as extensions.