diff options
author | Fujii Masao <fujii@postgresql.org> | 2021-04-27 14:41:27 +0900 |
---|---|---|
committer | Fujii Masao <fujii@postgresql.org> | 2021-04-27 14:41:27 +0900 |
commit | 8e9ea08bae93a754d5075b7bc9c0b2bc71958bfd (patch) | |
tree | 317013f67abe8af08f2fae54493f8e45b49e0822 /doc/src | |
parent | 3fa17d37716f978f80dfcdab4e7c73f3a24e7a48 (diff) | |
download | postgresql-8e9ea08bae93a754d5075b7bc9c0b2bc71958bfd.tar.gz postgresql-8e9ea08bae93a754d5075b7bc9c0b2bc71958bfd.zip |
Don't pass "ONLY" options specified in TRUNCATE to foreign data wrapper.
Commit 8ff1c94649 allowed TRUNCATE command to truncate foreign tables.
Previously the information about "ONLY" options specified in TRUNCATE
command were passed to the foreign data wrapper. Then postgres_fdw
constructed the TRUNCATE command to issue the remote server and
included "ONLY" options in it based on the passed information.
On the other hand, "ONLY" options specified in SELECT, UPDATE or DELETE
have no effect when accessing or modifying the remote table, i.e.,
are not passed to the foreign data wrapper. So it's inconsistent to
make only TRUNCATE command pass the "ONLY" options to the foreign data
wrapper. Therefore this commit changes the TRUNCATE command so that
it doesn't pass the "ONLY" options to the foreign data wrapper,
for the consistency with other statements. Also this commit changes
postgres_fdw so that it always doesn't include "ONLY" options in
the TRUNCATE command that it constructs.
Author: Fujii Masao
Reviewed-by: Bharath Rupireddy, Kyotaro Horiguchi, Justin Pryzby, Zhihong Yu
Discussion: https://postgr.es/m/551ed8c1-f531-818b-664a-2cecdab99cd8@oss.nttdata.com
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/fdwhandler.sgml | 29 | ||||
-rw-r--r-- | doc/src/sgml/postgres-fdw.sgml | 7 |
2 files changed, 20 insertions, 16 deletions
diff --git a/doc/src/sgml/fdwhandler.sgml b/doc/src/sgml/fdwhandler.sgml index 9f9274ce55f..e08441ec8bc 100644 --- a/doc/src/sgml/fdwhandler.sgml +++ b/doc/src/sgml/fdwhandler.sgml @@ -1071,28 +1071,16 @@ EndDirectModify(ForeignScanState *node); <para> <programlisting> void -ExecForeignTruncate(List *rels, List *rels_extra, - DropBehavior behavior, bool restart_seqs); +ExecForeignTruncate(List *rels, + DropBehavior behavior, + 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. <literal>rels_extra</literal> the list of - <literal>int</literal> value, which delivers extra information about - a foreign table to truncate. Possible values are - <literal>TRUNCATE_REL_CONTEXT_NORMAL</literal>, which means that - the foreign table is specified WITHOUT <literal>ONLY</literal> clause - in <command>TRUNCATE</command>, - <literal>TRUNCATE_REL_CONTEXT_ONLY</literal>, which means that - the foreign table is specified WITH <literal>ONLY</literal> clause, - and <literal>TRUNCATE_REL_CONTEXT_CASCADING</literal>, - which means that the foreign table is not specified explicitly, - but will be truncated due to dependency (for example, partition table). - There is one-to-one mapping between <literal>rels</literal> and - <literal>rels_extra</literal>. The number of entries is the same - between the two lists. + a foreign table to truncate. </para> <para> @@ -1112,6 +1100,15 @@ ExecForeignTruncate(List *rels, List *rels_extra, </para> <para> + Note that the <literal>ONLY</literal> options specified + in the original <command>TRUNCATE</command> command are not passed to + <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 diff --git a/doc/src/sgml/postgres-fdw.sgml b/doc/src/sgml/postgres-fdw.sgml index 5320accf6f4..b0806c1274e 100644 --- a/doc/src/sgml/postgres-fdw.sgml +++ b/doc/src/sgml/postgres-fdw.sgml @@ -70,6 +70,13 @@ </para> <para> + Note that the <literal>ONLY</literal> option specified in + <command>SELECT</command>, <command>UPDATE</command>, + <command>DELETE</command> or <command>TRUNCATE</command> + has no effect when accessing or modifying the remote table. + </para> + + <para> Note that <filename>postgres_fdw</filename> currently lacks support for <command>INSERT</command> statements with an <literal>ON CONFLICT DO UPDATE</literal> clause. However, the <literal>ON CONFLICT DO NOTHING</literal> |