Re: BUG #19686: Rolling back SET TABLESPACE

From: Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #19686: Rolling back SET TABLESPACE
Date: 2026-09-30 14:16:34
Message-ID: CAE8JnxNFNJBebqWdD4vOZWi2aCc3n7J901s3qWTu3L9t94EbAA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thank you Tom,

On Wed, Sep 30, 2026 at 2:40 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Alexandre Felipe <o(dot)alexandre(dot)felipe(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Borisov 2026-09-30 14:28:12 Re: [PATCH] intXshr, intXshl: return error on shift count out of range
Previous Message Egor Ivkov 2026-09-30 14:02:34 Re: [PATCH] intXshr, intXshl: return error on shift count out of range