Skip to content

Commit 0c8f408

Browse files
committed
doc: Review for "Allow TRUNCATE command to truncate foreign tables".
Typos, corrections and language improvements in the docs. Author: Justin Pryzby, Fujii Masao Reviewed-by: Bharath Rupireddy, Justin Pryzby, Fujii Masao Discussion: https://postgr.es/m/20210411041658.GB14564@telsasoft.com
1 parent 8e9ea08 commit 0c8f408

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

doc/src/sgml/fdwhandler.sgml

+17-20
Original file line numberDiff line numberDiff line change
@@ -1076,27 +1076,25 @@ ExecForeignTruncate(List *rels,
10761076
bool restart_seqs);
10771077
</programlisting>
10781078

1079-
Truncate a set of foreign tables specified in <literal>rels</literal>.
1080-
This function is called when <xref linkend="sql-truncate"/> is executed
1081-
on foreign tables. <literal>rels</literal> is the list of
1082-
<structname>Relation</structname> data structure that indicates
1083-
a foreign table to truncate.
1079+
Truncate foreign tables. This function is called when
1080+
<xref linkend="sql-truncate"/> is executed on a foreign table.
1081+
<literal>rels</literal> is a list of <structname>Relation</structname>
1082+
data structures of foreign tables to truncate.
10841083
</para>
10851084

10861085
<para>
1087-
<literal>behavior</literal> defines how foreign tables should
1088-
be truncated, using as possible values <literal>DROP_RESTRICT</literal>,
1089-
which means that <literal>RESTRICT</literal> option is specified,
1090-
and <literal>DROP_CASCADE</literal>, which means that
1091-
<literal>CASCADE</literal> option is specified, in
1092-
<command>TRUNCATE</command> command.
1086+
<literal>behavior</literal> is either <literal>DROP_RESTRICT</literal>
1087+
or <literal>DROP_CASCADE</literal> indicating that the
1088+
<literal>RESTRICT</literal> or <literal>CASCADE</literal> option was
1089+
requested in the original <command>TRUNCATE</command> command,
1090+
respectively.
10931091
</para>
10941092

10951093
<para>
1096-
<literal>restart_seqs</literal> is set to <literal>true</literal>
1097-
if <literal>RESTART IDENTITY</literal> option is specified in
1098-
<command>TRUNCATE</command> command. It is <literal>false</literal>
1099-
if <literal>CONTINUE IDENTITY</literal> option is specified.
1094+
If <literal>restart_seqs</literal> is <literal>true</literal>,
1095+
the original <command>TRUNCATE</command> command requested the
1096+
<literal>RESTART IDENTITY</literal> behavior, otherwise the
1097+
<literal>CONTINUE IDENTITY</literal> behavior was requested.
11001098
</para>
11011099

11021100
<para>
@@ -1109,11 +1107,10 @@ ExecForeignTruncate(List *rels,
11091107
</para>
11101108

11111109
<para>
1112-
<command>TRUNCATE</command> invokes
1113-
<function>ExecForeignTruncate</function> once per foreign server
1114-
that foreign tables to truncate belong to. This means that all foreign
1115-
tables included in <literal>rels</literal> must belong to the same
1116-
server.
1110+
<function>ExecForeignTruncate</function> is invoked once per
1111+
foreign server for which foreign tables are to be truncated.
1112+
This means that all foreign tables included in <literal>rels</literal>
1113+
must belong to the same server.
11171114
</para>
11181115

11191116
<para>

doc/src/sgml/postgres-fdw.sgml

+7-1
Original file line numberDiff line numberDiff line change
@@ -459,11 +459,17 @@ OPTIONS (ADD password_required 'false');
459459
<listitem>
460460
<para>
461461
This option controls whether <filename>postgres_fdw</filename> allows
462-
foreign tables to be truncated using <command>TRUNCATE</command>
462+
foreign tables to be truncated using the <command>TRUNCATE</command>
463463
command. It can be specified for a foreign table or a foreign server.
464464
A table-level option overrides a server-level option.
465465
The default is <literal>true</literal>.
466466
</para>
467+
468+
<para>
469+
Of course, if the remote table is not in fact truncatable, an error
470+
would occur anyway. Use of this option primarily allows the error to
471+
be thrown locally without querying the remote server.
472+
</para>
467473
</listitem>
468474
</varlistentry>
469475
</variablelist>

doc/src/sgml/ref/truncate.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ TRUNCATE [ TABLE ] [ ONLY ] <replaceable class="parameter">name</replaceable> [
173173

174174
<para>
175175
<command>TRUNCATE</command> can be used for foreign tables if
176-
the foreign data wrapper supports, for instance,
176+
supported by the foreign data wrapper, for instance,
177177
see <xref linkend="postgres-fdw"/>.
178178
</para>
179179
</refsect1>

0 commit comments

Comments
 (0)