Re: BUG #19686: Rolling back SET TABLESPACE - Mailing list pgsql-hackers

From Alexandre Felipe
Subject Re: BUG #19686: Rolling back SET TABLESPACE
Date
Msg-id CAE8JnxNFNJBebqWdD4vOZWi2aCc3n7J901s3qWTu3L9t94EbAA@mail.gmail.com
Whole thread
In response to Re: BUG #19686: Rolling back SET TABLESPACE  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Thank you Tom,

On Wed, Sep 30, 2026 at 2:40 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Alexandre Felipe <o.alexandre.felipe@gmail.com> writes:
> What if we simply block modifications to the table in a transaction
> after it moved to a new tablespace?

If we were looking for a quick-n-dirty functionality-losing patch,
we'd just reject ALTER SET TABLESPACE within transaction blocks.
Perhaps that's the right answer for the back branches, but
I'd prefer not to go that way.
 
Noted, but could you please address the question directly.

Currently ALTER SET TABLESPACE already locks the tables,
blocking changes to the old file, this prevents corrupted indices on
committed transactions.
What I suggested was to mirror that restriction inside the transaction,
i.e. you can't modify the table in the new tablespace during the
transaction.

We lose one feature  but one could even argue that it makes the
behaviour more consistent in some sense.

It seems to me that there is consensus among the senior hackers

I see, there is a consensus that deferring file copies is 
not a good trade-off and I am not pushing for that.

Regards,
Alexandre Felipe

pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Allow table AMs to define their own reloptions
Next
From: Pavel Borisov
Date:
Subject: Re: [PATCH] intXshr, intXshl: return error on shift count out of range