aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src/sgml/ref')
-rw-r--r--doc/src/sgml/ref/alter_table.sgml12
-rw-r--r--doc/src/sgml/ref/delete.sgml27
-rw-r--r--doc/src/sgml/ref/lock.sgml10
-rw-r--r--doc/src/sgml/ref/select.sgml33
-rw-r--r--doc/src/sgml/ref/truncate.sgml12
-rw-r--r--doc/src/sgml/ref/update.sgml14
6 files changed, 56 insertions, 52 deletions
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index a9fc887c778..94343f88f6e 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -490,10 +490,12 @@ ALTER TABLE <replaceable class="PARAMETER">name</replaceable>
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
- The name (possibly schema-qualified) of an existing table to
- alter. If <literal>ONLY</> is specified, only that table is
- altered. If <literal>ONLY</> is not specified, the table and any
- descendant tables are altered.
+ The name (optionally schema-qualified) of an existing table to
+ alter. If <literal>ONLY</> is specified before the table name, only
+ that table is altered. If <literal>ONLY</> is not specified, the table
+ and all its descendant tables (if any) are altered. Optionally,
+ <literal>*</> can be specified after the table name to explicitly
+ indicate that descendant tables are included.
</para>
</listitem>
</varlistentry>
@@ -877,7 +879,7 @@ ALTER TABLE distributors DROP CONSTRAINT zipchk;
</para>
<para>
- To remove a check constraint from a table only:
+ To remove a check constraint from one table only:
<programlisting>
ALTER TABLE ONLY distributors DROP CONSTRAINT zipchk;
</programlisting>
diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml
index 84bf6bd23f9..6c641b0b30a 100644
--- a/doc/src/sgml/ref/delete.sgml
+++ b/doc/src/sgml/ref/delete.sgml
@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ] <replaceable class="parameter">alias</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> ]
[ RETURNING * | <replaceable class="parameter">output_expression</replaceable> [ [ AS ] <replaceable class="parameter">output_name</replaceable> ] [, ...] ]
@@ -47,13 +47,6 @@ DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ]
</tip>
<para>
- By default, <command>DELETE</command> will delete rows in the
- specified table and all its child tables. If you wish to delete only
- from the specific table mentioned, you must use the
- <literal>ONLY</literal> clause.
- </para>
-
- <para>
There are two ways to delete rows in a table using information
contained in other tables in the database: using sub-selects, or
specifying additional tables in the <literal>USING</literal> clause.
@@ -84,20 +77,16 @@ DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ]
<variablelist>
<varlistentry>
- <term><literal>ONLY</></term>
- <listitem>
- <para>
- If specified, delete rows from the named table only. When not
- specified, any tables inheriting from the named table are also processed.
- </para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><replaceable class="parameter">table</replaceable></term>
<listitem>
<para>
- The name (optionally schema-qualified) of an existing table.
+ The name (optionally schema-qualified) of the table to delete rows
+ from. If <literal>ONLY</> is specified before the table name,
+ matching rows are deleted from the named table only. If
+ <literal>ONLY</> is not specified, matching rows are also deleted
+ from any tables inheriting from the named table. Optionally,
+ <literal>*</> can be specified after the table name to explicitly
+ indicate that descendant tables are included.
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/lock.sgml b/doc/src/sgml/ref/lock.sgml
index a61cb98c7a3..a7f7551c566 100644
--- a/doc/src/sgml/ref/lock.sgml
+++ b/doc/src/sgml/ref/lock.sgml
@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-LOCK [ TABLE ] [ ONLY ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ IN <replaceable class="PARAMETER">lockmode</replaceable> MODE ] [ NOWAIT ]
+LOCK [ TABLE ] [ ONLY ] <replaceable class="PARAMETER">name</replaceable> [ * ] [, ...] [ IN <replaceable class="PARAMETER">lockmode</replaceable> MODE ] [ NOWAIT ]
<phrase>where <replaceable class="PARAMETER">lockmode</replaceable> is one of:</phrase>
@@ -109,9 +109,11 @@ LOCK [ TABLE ] [ ONLY ] <replaceable class="PARAMETER">name</replaceable> [, ...
<listitem>
<para>
The name (optionally schema-qualified) of an existing table to
- lock. If <literal>ONLY</> is specified, only that table is
- locked. If <literal>ONLY</> is not specified, the table and all
- its descendant tables (if any) are locked.
+ lock. If <literal>ONLY</> is specified before the table name, only that
+ table is locked. If <literal>ONLY</> is not specified, the table and all
+ its descendant tables (if any) are locked. Optionally, <literal>*</>
+ can be specified after the table name to explicitly indicate that
+ descendant tables are included.
</para>
<para>
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index 3fbfda309e2..0297415bdc6 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -268,10 +268,12 @@ TABLE { [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ] |
<term><replaceable class="parameter">table_name</replaceable></term>
<listitem>
<para>
- The name (optionally schema-qualified) of an existing table or
- view. If <literal>ONLY</> is specified, only that table is
- scanned. If <literal>ONLY</> is not specified, the table and
- any descendant tables are scanned.
+ The name (optionally schema-qualified) of an existing table or view.
+ If <literal>ONLY</> is specified before the table name, only that
+ table is scanned. If <literal>ONLY</> is not specified, the table
+ and all its descendant tables (if any) are scanned. Optionally,
+ <literal>*</> can be specified after the table name to explicitly
+ indicate that descendant tables are included.
</para>
</listitem>
</varlistentry>
@@ -1555,15 +1557,24 @@ SELECT distributors.* WHERE distributors.name = 'Westward';
</refsect2>
<refsect2>
- <title><literal>ONLY</literal> and Parentheses</title>
+ <title><literal>ONLY</literal> and Inheritance</title>
<para>
- The SQL standard requires parentheses around the table name
- after <literal>ONLY</literal>, as in <literal>SELECT * FROM ONLY
- (tab1), ONLY (tab2) WHERE ...</literal>. PostgreSQL supports that
- as well, but the parentheses are optional. (This point applies
- equally to all SQL commands supporting the <literal>ONLY</literal>
- option.)
+ The SQL standard requires parentheses around the table name when
+ writing <literal>ONLY</literal>, for example <literal>SELECT * FROM ONLY
+ (tab1), ONLY (tab2) WHERE ...</literal>. <productname>PostgreSQL</>
+ considers these parentheses to be optional.
+ </para>
+
+ <para>
+ <productname>PostgreSQL</> allows a trailing <literal>*</> to be written to
+ explicitly specify the non-<literal>ONLY</literal> behavior of including
+ child tables. The standard does not allow this.
+ </para>
+
+ <para>
+ (These points apply equally to all SQL commands supporting the
+ <literal>ONLY</literal> option.)
</para>
</refsect2>
diff --git a/doc/src/sgml/ref/truncate.sgml b/doc/src/sgml/ref/truncate.sgml
index 08dc670843a..99202de5b49 100644
--- a/doc/src/sgml/ref/truncate.sgml
+++ b/doc/src/sgml/ref/truncate.sgml
@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-TRUNCATE [ TABLE ] [ ONLY ] <replaceable class="PARAMETER">name</replaceable> [, ... ]
+TRUNCATE [ TABLE ] [ ONLY ] <replaceable class="PARAMETER">name</replaceable> [ * ] [, ... ]
[ RESTART IDENTITY | CONTINUE IDENTITY ] [ CASCADE | RESTRICT ]
</synopsis>
</refsynopsisdiv>
@@ -47,10 +47,12 @@ TRUNCATE [ TABLE ] [ ONLY ] <replaceable class="PARAMETER">name</replaceable> [,
<term><replaceable class="PARAMETER">name</replaceable></term>
<listitem>
<para>
- The name (optionally schema-qualified) of a table to be
- truncated. If <literal>ONLY</> is specified, only that table is
- truncated. If <literal>ONLY</> is not specified, the table and
- all its descendant tables (if any) are truncated.
+ The name (optionally schema-qualified) of a table to truncate.
+ If <literal>ONLY</> is specified before the table name, only that table
+ is truncated. If <literal>ONLY</> is not specified, the table and all
+ its descendant tables (if any) are truncated. Optionally, <literal>*</>
+ can be specified after the table name to explicitly indicate that
+ descendant tables are included.
</para>
</listitem>
</varlistentry>
diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml
index 8673df18ff4..10045c1683b 100644
--- a/doc/src/sgml/ref/update.sgml
+++ b/doc/src/sgml/ref/update.sgml
@@ -21,7 +21,7 @@ PostgreSQL documentation
<refsynopsisdiv>
<synopsis>
-UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ] <replaceable class="parameter">alias</replaceable> ]
+UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ * ] [ [ AS ] <replaceable class="parameter">alias</replaceable> ]
SET { <replaceable class="PARAMETER">column</replaceable> = { <replaceable class="PARAMETER">expression</replaceable> | DEFAULT } |
( <replaceable class="PARAMETER">column</replaceable> [, ...] ) = ( { <replaceable class="PARAMETER">expression</replaceable> | DEFAULT } [, ...] ) } [, ...]
[ FROM <replaceable class="PARAMETER">from_list</replaceable> ]
@@ -41,13 +41,6 @@ UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ] <rep
</para>
<para>
- By default, <command>UPDATE</command> will update rows in the
- specified table and all its subtables. If you wish to only update
- the specific table mentioned, you must use the <literal>ONLY</>
- clause.
- </para>
-
- <para>
There are two ways to modify a table using information contained in
other tables in the database: using sub-selects, or specifying
additional tables in the <literal>FROM</literal> clause. Which
@@ -84,6 +77,11 @@ UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ [ AS ] <rep
<listitem>
<para>
The name (optionally schema-qualified) of the table to update.
+ If <literal>ONLY</> is specified before the table name, matching rows
+ are updated in the named table only. If <literal>ONLY</> is not
+ specified, matching rows are also updated in any tables inheriting from
+ the named table. Optionally, <literal>*</> can be specified after the
+ table name to explicitly indicate that descendant tables are included.
</para>
</listitem>
</varlistentry>