Appears I forgot to update the docs earlier.

Please note I have no way to test this.  Docbook doesn't like my
cygwin setup.

--
Rod Taylor
This commit is contained in:
Bruce Momjian 2002-04-24 02:31:30 +00:00
parent 80e232f2b8
commit 9fcc1159be
1 changed files with 30 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/insert.sgml,v 1.17 2002/04/23 02:07:16 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/insert.sgml,v 1.18 2002/04/24 02:31:30 momjian Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
@ -22,9 +22,9 @@ PostgreSQL documentation
</refsynopsisdivinfo> </refsynopsisdivinfo>
<synopsis> <synopsis>
INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ] INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
{ DEFAULT VALUES | VALUES ( <replaceable class="PARAMETER">expression</replaceable> [, ...] ) | SELECT <replaceable class="PARAMETER">query</replaceable> } { DEFAULT VALUES | VALUES ( { <replaceable class="PARAMETER">expression</replaceable> | DEFAULT } [, ...] ) | SELECT <replaceable class="PARAMETER">query</replaceable> }
</synopsis> </synopsis>
<refsect2 id="R2-SQL-INSERT-1"> <refsect2 id="R2-SQL-INSERT-1">
<title> <title>
Inputs Inputs
@ -71,6 +71,16 @@ INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><replaceable class="PARAMETER">DEFAULT</replaceable></term>
<listitem>
<para>
This column will be filled in by the column DEFAULT clause, or NULL if
a default is not available.
</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">query</replaceable></term> <term><replaceable class="PARAMETER">query</replaceable></term>
<listitem> <listitem>
@ -83,7 +93,7 @@ INSERT INTO <replaceable class="PARAMETER">table</replaceable> [ ( <replaceable
</variablelist> </variablelist>
</para> </para>
</refsect2> </refsect2>
<refsect2 id="R2-SQL-INSERT-2"> <refsect2 id="R2-SQL-INSERT-2">
<title> <title>
Outputs Outputs
@ -133,7 +143,7 @@ INSERT 0 <replaceable>#</replaceable>
</para> </para>
<para> <para>
Each column not present in the target list will be inserted Each column not present in the target list will be inserted
using a default value, either a declared DEFAULT value using a default value, either a declared DEFAULT value
or NULL. <productname>PostgreSQL</productname> will reject the new or NULL. <productname>PostgreSQL</productname> will reject the new
column if a NULL is inserted into a column declared NOT NULL. column if a NULL is inserted into a column declared NOT NULL.
@ -175,6 +185,18 @@ INSERT INTO films (code, title, did, date_prod, kind)
</programlisting> </programlisting>
</para> </para>
<para>
In the third example, we use the DEFAULT values for the date columns
rather than specifying an entry.
<programlisting>
INSERT INTO films VALUES
('UA502','Bananas',105,DEFAULT,'Comedy',INTERVAL '82 minute');
INSERT INTO films (code, title, did, date_prod, kind)
VALUES ('T_601', 'Yojimbo', 106, DEFAULT, 'Drama');
</programlisting>
</para>
<para> <para>
Insert a single row into table distributors; note that Insert a single row into table distributors; note that
only column <literal>name</literal> is specified, so the omitted only column <literal>name</literal> is specified, so the omitted
@ -197,7 +219,7 @@ INSERT INTO films SELECT * FROM tmp;
Insert into arrays (refer to the Insert into arrays (refer to the
<citetitle>PostgreSQL User's Guide</citetitle> for further <citetitle>PostgreSQL User's Guide</citetitle> for further
information about arrays): information about arrays):
<programlisting> <programlisting>
-- Create an empty 3x3 gameboard for noughts-and-crosses -- Create an empty 3x3 gameboard for noughts-and-crosses
-- (all of these queries create the same board attribute) -- (all of these queries create the same board attribute)
@ -215,14 +237,14 @@ INSERT INTO tictactoe (game, board)
<title> <title>
Compatibility Compatibility
</title> </title>
<refsect2 id="R2-SQL-INSERT-4"> <refsect2 id="R2-SQL-INSERT-4">
<title> <title>
SQL92 SQL92
</title> </title>
<para> <para>
<command>INSERT</command> is fully compatible with <acronym>SQL92</acronym>. <command>INSERT</command> is fully compatible with <acronym>SQL92</acronym>.
Possible limitations in features of the Possible limitations in features of the
<replaceable class="PARAMETER">query</replaceable> <replaceable class="PARAMETER">query</replaceable>
clause are documented for clause are documented for
<xref linkend="sql-select" endterm="sql-select-title">. <xref linkend="sql-select" endterm="sql-select-title">.