Re: TRUNCATE on foreign table

Fujii Masao <masao.fujii@oss.nttdata.com>

From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Kazutaka Onishi <onishi@heterodb.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Kohei KaiGai <kaigai@heterodb.com>, Zhihong Yu <zyu@yugabyte.com>, Amit Langote <amitlangote09@gmail.com>, Ibrar Ahmed <ibrar.ahmad@gmail.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: 2021-04-07T19:19:37Z
Lists: pgsql-hackers

On 2021/04/06 21:06, Kazutaka Onishi wrote:
> Thank you for checking v13, and here is v14 patch.
> 
>> 1) Are we using all of these macros? I see that we are setting them
>> but we only use TRUNCATE_REL_CONTEXT_ONLY. If not used, can we remove
>> them?
> 
> These may be needed for the foreign data handler other than postgres_fdw.

Could you tell me how such FDWs use TRUNCATE_REL_CONTEXT_CASCADING and _NORMAL? I'm still not sure if TRUNCATE_REL_CONTEXT_CASCADING is really required.

With the patch, both inherited and referencing relations are marked as TRUNCATE_REL_CONTEXT_CASCADING? Is this ok for that use? Or we should distinguish them?

+#define TRUNCATE_REL_CONTEXT_NORMAL       0x01
+#define TRUNCATE_REL_CONTEXT_ONLY         0x02
+#define TRUNCATE_REL_CONTEXT_CASCADING     0x04

With the patch, these are defined as flag bits. But ExecuteTruncate() seems to always set the entry in relids_extra to either of them, not the combination of them. So we can define them as enum?

Regards,

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



Commits

  1. doc: Review for "Allow TRUNCATE command to truncate foreign tables".

  2. Don't pass "ONLY" options specified in TRUNCATE to foreign data wrapper.

  3. Support tab-complete for TRUNCATE on foreign tables.

  4. Allow TRUNCATE command to truncate foreign tables.

  5. Add support for asynchronous execution.