mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
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.
This commit is contained in:
@@ -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> ]
|
||||
@@ -83,6 +84,18 @@ DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ]
|
||||
<title>Parameters</title>
|
||||
|
||||
<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>
|
||||
@@ -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>
|
||||
|
Reference in New Issue
Block a user