diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-10-15 19:53:59 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-10-15 19:55:25 -0400 |
| commit | 07f1264dda0e776a7e329b091c127059bce8cc54 (patch) | |
| tree | c77493be3b7c010de069a431035b80db720b0969 /doc/src/sgml/ref/delete.sgml | |
| parent | 6ab42ae36713b1e6f961c37e22f99d3e6267523b (diff) | |
Allow WITH clauses to be attached to INSERT, UPDATE, DELETE statements.
This is not the hoped-for facility of using INSERT/UPDATE/DELETE inside
a WITH, but rather the other way around. It seems useful in its own
right anyway.
Note: catversion bumped because, although the contents of stored rules
might look compatible, there's actually a subtle semantic change.
A single Query containing a WITH and INSERT...VALUES now represents
writing the WITH before the INSERT, not before the VALUES. While it's
not clear that that matters to anyone, it seems like a good idea to
have it cited in the git history for catversion.h.
Original patch by Marko Tiikkaja, with updating and cleanup by
Hitoshi Harada.
Diffstat (limited to 'doc/src/sgml/ref/delete.sgml')
| -rw-r--r-- | doc/src/sgml/ref/delete.sgml | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml index c87f35c9b40..9406f4e3af0 100644 --- a/doc/src/sgml/ref/delete.sgml +++ b/doc/src/sgml/ref/delete.sgml @@ -21,6 +21,7 @@ PostgreSQL documentation <refsynopsisdiv> <synopsis> +[ WITH [ RECURSIVE ] <replaceable class="parameter">with_query</replaceable> [, ...] ] DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ] <replaceable class="parameter">alias</replaceable> ] [ USING <replaceable class="PARAMETER">using_list</replaceable> ] [ WHERE <replaceable class="PARAMETER">condition</replaceable> | WHERE CURRENT OF <replaceable class="PARAMETER">cursor_name</replaceable> ] @@ -84,6 +85,18 @@ DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ] <variablelist> <varlistentry> + <term><replaceable class="parameter">with_query</replaceable></term> + <listitem> + <para> + The <literal>WITH</literal> clause allows you to specify one or more + subqueries that can be referenced by name in the <command>DELETE</> + query. See <xref linkend="queries-with"> and <xref linkend="sql-select"> + for details. + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><literal>ONLY</></term> <listitem> <para> @@ -272,7 +285,8 @@ DELETE FROM tasks WHERE CURRENT OF c_tasks; <para> This command conforms to the <acronym>SQL</acronym> standard, except that the <literal>USING</literal> and <literal>RETURNING</> clauses - are <productname>PostgreSQL</productname> extensions. + are <productname>PostgreSQL</productname> extensions, as is the ability + to use <literal>WITH</> with <command>DELETE</>. </para> </refsect1> </refentry> |
