pgsql: Don't pass "ONLY" options specified in TRUNCATE to foreign data

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't pass "ONLY" options specified in TRUNCATE to foreign data
Date: 2021-04-27 05:42:18
Message-ID: E1lbGUE-0002jS-C0@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/8e9ea08bae93a754d5075b7bc9c0b2bc71958bfd

Modified Files
--------------
contrib/postgres_fdw/deparse.c | 13 ++++------
contrib/postgres_fdw/expected/postgres_fdw.out | 24 ++++++++++++-------
contrib/postgres_fdw/postgres_fdw.c | 4 +---
contrib/postgres_fdw/postgres_fdw.h | 1 -
contrib/postgres_fdw/sql/postgres_fdw.sql | 16 +++++++++----
doc/src/sgml/fdwhandler.sgml | 29 ++++++++++------------
doc/src/sgml/postgres-fdw.sgml | 7 ++++++
src/backend/commands/tablecmds.c | 33 +++++++-------------------
src/backend/replication/logical/worker.c | 4 ----
src/include/commands/tablecmds.h | 11 ---------
src/include/foreign/fdwapi.h | 1 -
11 files changed, 60 insertions(+), 83 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Fujii Masao 2021-04-27 09:40:12 pgsql: doc: Review for "Allow TRUNCATE command to truncate foreign tabl
Previous Message Amit Kapila 2021-04-27 03:50:30 pgsql: Use HTAB for replication slot statistics.