Re: TRUNCATE on foreign table

Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>

From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Kazutaka Onishi <onishi@heterodb.com>, Zhihong Yu <zyu@yugabyte.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>, Kohei KaiGai <kaigai@heterodb.com>
Date: 2021-02-09T12:19:01Z
Lists: pgsql-hackers
On Tue, Feb 9, 2021 at 5:31 PM Ashutosh Bapat
<ashutosh.bapat.oss@gmail.com> wrote:
> Why would one want to truncate a foreign table instead of truncating
> actual table wherever it is?

I think when the deletion on foreign tables (which actually deletes
rows from the remote table?) is allowed, it does make sense to have a
way to truncate the remote table via foreign table. Also, it can avoid
going to each and every remote server and doing the truncation
instead.

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com



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.