Re: TRUNCATE on foreign table - Mailing list pgsql-hackers

From Ashutosh Bapat
Subject Re: TRUNCATE on foreign table
Date
Msg-id CAExHW5sb6jFFB4MBw+fHkSs0pKzD6=Ux=08kfiPN1_gEh4QSKg@mail.gmail.com
Whole thread Raw
In response to Re: TRUNCATE on foreign table  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Responses Re: TRUNCATE on foreign table
List pgsql-hackers
On Tue, Feb 9, 2021 at 5:49 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> 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.

DELETE is very different from TRUNCATE. Application may want to DELETE
based on a join with a local table and hence it can not be executed on
a foreign server. That's not true with TRUNCATE.

-- 
Best Wishes,
Ashutosh Bapat



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pg_replication_origin_drop API potential race condition
Next
From: Matthias van de Meent
Date:
Subject: Re: Improvements and additions to COPY progress reporting