truncate_foreign_table_docs_v3.patch
text/plain
Filename: truncate_foreign_table_docs_v3.patch
Type: text/plain
Part: 0
Message:
Re: TRUNCATE on foreign table
Patch
Format: unified
Series: patch v3
| File | + | − |
|---|---|---|
| doc/src/sgml/fdwhandler.sgml | 20 | 23 |
| doc/src/sgml/postgres-fdw.sgml | 7 | 1 |
| doc/src/sgml/ref/truncate.sgml | 1 | 1 |
diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml
index 0e2cd3628c..70d89393d9 100644
--- a/doc/src/sgml/fdwhandler.sgml
+++ b/doc/src/sgml/fdwhandler.sgml
@@ -1076,44 +1076,41 @@ ExecForeignTruncate(List *rels,
bool restart_seqs);
</programlisting>
- Truncate a set of foreign tables specified in <literal>rels</literal>.
- This function is called when <xref linkend="sql-truncate"/> is executed
- on foreign tables. <literal>rels</literal> is the list of
- <structname>Relation</structname> data structure that indicates
- a foreign table to truncate.
+ Truncate foreign tables. This function is called when
+ <xref linkend="sql-truncate"/> is executed on a foreign table.
+ <literal>rels</literal> is a list of <structname>Relation</structname>
+ data structures of foreign tables to truncate.
</para>
<para>
- <literal>behavior</literal> defines how foreign tables should
- be truncated, using as possible values <literal>DROP_RESTRICT</literal>,
- which means that <literal>RESTRICT</literal> option is specified,
- and <literal>DROP_CASCADE</literal>, which means that
- <literal>CASCADE</literal> option is specified, in
- <command>TRUNCATE</command> command.
+ <literal>behavior</literal> is either <literal>DROP_RESTRICT</literal>
+ or <literal>DROP_CASCADE</literal> indicating that the
+ <literal>RESTRICT</literal> or <literal>CASCADE</literal> option was
+ requested in the original <command>TRUNCATE</command> command,
+ respectively.
</para>
<para>
- <literal>restart_seqs</literal> is set to <literal>true</literal>
- if <literal>RESTART IDENTITY</literal> option is specified in
- <command>TRUNCATE</command> command. It is <literal>false</literal>
- if <literal>CONTINUE IDENTITY</literal> option is specified.
+ If <literal>restart_seqs</literal> is <literal>true</literal>,
+ the original <command>TRUNCATE</command> command requested the
+ <literal>RESTART IDENTITY</literal> behavior, otherwise the
+ <literal>CONTINUE IDENTITY</literal> behavior was requested.
</para>
<para>
- Note that information about <literal>ONLY</literal> options specified
+ Note that the <literal>ONLY</literal> options specified
in the original <command>TRUNCATE</command> command is not passed to
- <function>ExecForeignTruncate</function>. This is the same behavior as
- for the callback functions for <command>SELECT</command>,
+ <function>ExecForeignTruncate</function>. This behavior is similar to
+ the callback functions of <command>SELECT</command>,
<command>UPDATE</command> and <command>DELETE</command> on
a foreign table.
</para>
<para>
- <command>TRUNCATE</command> invokes
- <function>ExecForeignTruncate</function> once per foreign server
- that foreign tables to truncate belong to. This means that all foreign
- tables included in <literal>rels</literal> must belong to the same
- server.
+ <function>ExecForeignTruncate</function> is invoked once per
+ foreign server for which foreign tables are to be truncated.
+ This means that all foreign tables included in <literal>rels</literal>
+ must belong to the same server.
</para>
<para>
diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml
index b0806c1274..839126c4ef 100644
--- a/doc/src/sgml/postgres-fdw.sgml
+++ b/doc/src/sgml/postgres-fdw.sgml
@@ -459,11 +459,17 @@ OPTIONS (ADD password_required 'false');
<listitem>
<para>
This option controls whether <filename>postgres_fdw</filename> allows
- foreign tables to be truncated using <command>TRUNCATE</command>
+ foreign tables to be truncated using the <command>TRUNCATE</command>
command. It can be specified for a foreign table or a foreign server.
A table-level option overrides a server-level option.
The default is <literal>true</literal>.
</para>
+
+ <para>
+ Of course, if the remote table is not in fact truncatable, an error
+ would occur anyway. Use of this option primarily allows the error to
+ be thrown locally without querying the remote server.
+ </para>
</listitem>
</varlistentry>
</variablelist>
diff --git a/doc/src/sgml/ref/truncate.sgml b/doc/src/sgml/ref/truncate.sgml
index acf3633be4..9af42dd008 100644
--- a/doc/src/sgml/ref/truncate.sgml
+++ b/doc/src/sgml/ref/truncate.sgml
@@ -173,7 +173,7 @@ TRUNCATE [ TABLE ] [ ONLY ] <replaceable class="parameter">name</replaceable> [
<para>
<command>TRUNCATE</command> can be used for foreign tables if
- the foreign data wrapper supports, for instance,
+ supported by the foreign data wrapper,
see <xref linkend="postgres-fdw"/>.
</para>
</refsect1>