pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Kazutaka Onishi <onishi@heterodb.com>
Cc: Amit Langote <amitlangote09@gmail.com>
Cc: Ibrar Ahmed <ibrar.ahmad@gmail.com>
Cc: Kohei KaiGai <kaigai@heterodb.com>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Cc: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Subject: Re: TRUNCATE on foreign table
Date: Tue, 30 Mar 2021 03:45:04 +0900
Message-ID: <c427d3ec-00df-0535-e896-2f1f1baa2dbd@oss.nttdata.com> (raw)
In-Reply-To: <CAJuF6cNU3xS35Q8rUVAZoDJtVeKUZ6SaEW_8KxTdfZd0BMWaQg@mail.gmail.com>
References: <CAJuF6cMWDDqU-vn_knZgma+2GMaout68YUgn1uyDnexRhqqM5Q@mail.gmail.com>
	<CAExHW5uWU85myXdgO_okW=Ab3+JLXOO1hbAb_Y1rdRZo5q+tQg@mail.gmail.com>
	<CALj2ACUryBiJvdrEnghnygPaaniyobjZxzK96h-xwah9LWpX3w@mail.gmail.com>
	<CAExHW5sb6jFFB4MBw+fHkSs0pKzD6=Ux=08kfiPN1_gEh4QSKg@mail.gmail.com>
	<CAJuF6cNVJC5+C2ci0FCgJBpSX8NZF+eaMTbcboDRtTPyagUttA@mail.gmail.com>
	<CAExHW5uk+J61fVgcf+HYNZTuY9UnFnLhr34wMYU26mCtpf8i5w@mail.gmail.com>
	<CAJuF6cPwm13tnfRUAcy2CpncEvrGUOaJPuz4rWVFixL28zTA1g@mail.gmail.com>
	<CAExHW5tceUdJSYMy6R8uYzJ2upKfKdJdWPyUmM16-_xEdFGL0g@mail.gmail.com>
	<CALtqXTdRzbnDqYv-bA3N83+C6+=NkWa=R69sSk=-PZgHdBY0Bg@mail.gmail.com>
	<CA+HiwqFVecXnLUtTv6J2hTyEdkVtkTae3QNfOKRobu+L_1=9QA@mail.gmail.com>
	<CAJuF6cN4oU==vATJ7AgSqxCzV6X7j95O97LtKJcwddVcAcEx1w@mail.gmail.com>
	<CAJuF6cMxN=3myt3Uf3hhpwrXy4kFsDbdq9O_9NOJgNU5AB-AUw@mail.gmail.com>
	<66da56a4-ed5a-a18f-0f5e-b4d21cda71af@oss.nttdata.com>
	<CAJuF6cNU3xS35Q8rUVAZoDJtVeKUZ6SaEW_8KxTdfZd0BMWaQg@mail.gmail.com>



On 2021/03/28 2:37, Kazutaka Onishi wrote:
> Fujii-san,
> 
> Thank you for your review!
> Now I prepare v5 patch and I'll answer to your each comment. please
> check this again.
> m(_ _)m
> 
> 1. In postgres-fdw.sgml, "and truncatable" should be appended into the
> above first description?
> 2. truncate.sgml should be updated because, for example, it contains
> the above descriptions.
> 
> Yeah, you're right. I've fixed it.
> 
> 
> 
> 3.  Don't we need to document the detail information about frels_extra?
> 
> I've written about frels_extra into fdwhander.sgml.
> 
> 
> 
> 4. postgres_fdw determines whether to specify ONLY or not by checking
> whether the passed extra value is zero or not.
> 
> Please refer this:
> https://www.postgresql.org/message-id/CAOP8fzb-t3WVNLjGMC%2B4sV4AZa9S%3DMAQ7Q6pQoADMCf_1jp4ew%40mail...
>> Negative value means that foreign-tables are not specified in the TRUNCATE
>> command, but truncated due to dependency (like partition's child leaf).
> 
> I've added this information into fdwhandler.sgml.

Even when a foreign table is specified explicitly in TRUNCATE command,
its extra value can be negative if it's found as an inherited children firstly
(i.e., in the case where the partitioned table having that foreign table as
its partition is specified explicitly in TRUNCATE command).
Isn't this a problem?

Please imagine the following example;

----------------------------------
create extension postgres_fdw;
create server loopback foreign data wrapper postgres_fdw;
create user mapping for public server loopback;

create table t (i int, j int) partition by hash (j);
create table t0 partition of t for values with (modulus 2, remainder 0);
create table t1 partition of t for values with (modulus 2, remainder 1);

create table test (i int, j int) partition by hash (i);
create table test0 partition of test for values with (modulus 2, remainder 0);
create foreign table ft partition of test for values with (modulus 2, remainder 1) server loopback options (table_name 't');
----------------------------------

In this example, "truncate ft, test" works fine, but "truncate test, ft" causes
an error though they should work in the same way basically.

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION





view thread (117+ messages)  latest in thread

Message-ID: <c427d3ec-00df-0535-e896-2f1f1baa2dbd@oss.nttdata.com>
Permalink:  ../c427d3ec-00df-0535-e896-2f1f1baa2dbd@oss.nttdata.com/
Also on:    postgresql.org/message-id/c427d3ec-00df-0535-e896-2f1f1baa2dbd@oss.nttdata.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, onishi@heterodb.com, amitlangote09@gmail.com, ibrar.ahmad@gmail.com, kaigai@heterodb.com, bharath.rupireddyforpostgres@gmail.com, zyu@yugabyte.com, ashutosh.bapat.oss@gmail.com
  Subject: Re: TRUNCATE on foreign table
  In-Reply-To: <c427d3ec-00df-0535-e896-2f1f1baa2dbd@oss.nttdata.com>
  References: <CAJuF6cMWDDqU-vn_knZgma+2GMaout68YUgn1uyDnexRhqqM5Q@mail.gmail.com> <CALj2ACUryBiJvdrEnghnygPaaniyobjZxzK96h-xwah9LWpX3w@mail.gmail.com> <CAExHW5sb6jFFB4MBw+fHkSs0pKzD6=Ux=08kfiPN1_gEh4QSKg@mail.gmail.com> <CAJuF6cNVJC5+C2ci0FCgJBpSX8NZF+eaMTbcboDRtTPyagUttA@mail.gmail.com> <CAExHW5uk+J61fVgcf+HYNZTuY9UnFnLhr34wMYU26mCtpf8i5w@mail.gmail.com> <CAJuF6cPwm13tnfRUAcy2CpncEvrGUOaJPuz4rWVFixL28zTA1g@mail.gmail.com> <CAExHW5tceUdJSYMy6R8uYzJ2upKfKdJdWPyUmM16-_xEdFGL0g@mail.gmail.com> <CALtqXTdRzbnDqYv-bA3N83+C6+=NkWa=R69sSk=-PZgHdBY0Bg@mail.gmail.com> <CA+HiwqFVecXnLUtTv6J2hTyEdkVtkTae3QNfOKRobu+L_1=9QA@mail.gmail.com> <CAJuF6cN4oU==vATJ7AgSqxCzV6X7j95O97LtKJcwddVcAcEx1w@mail.gmail.com> <CAJuF6cMxN=3myt3Uf3hhpwrXy4kFsDbdq9O_9NOJgNU5AB-AUw@mail.gmail.com> <66da56a4-ed5a-a18f-0f5e-b4d21cda71af@oss.nttdata.com> <CAJuF6cNU3xS35Q8rUVAZoDJtVeKUZ6SaEW_8KxTdfZd0BMWaQg@mail.gmail.com> <c427d3ec-00df-0535-e896-2f1f1baa2dbd@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox