Re: Are these metadata ALTER TABLE commands transactionally safe?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: Are these metadata ALTER TABLE commands transactionally safe?
Date: 2026-05-15 01:13:03
Message-ID: CAKFQuwYNKr8_ro8_-jwbfxwGaOWrA9e7-9E3+1mboMAPnR-V+w@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thursday, May 14, 2026, Ron Johnson <ronljohnsonjr(at)gmail(dot)com> wrote:

> On Thu, May 14, 2026 at 5:26 PM David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
>> On Thursday, May 14, 2026, Ron Johnson <ronljohnsonjr(at)gmail(dot)com> wrote:
>>
>>> PG 17.9
>>>
>>> BEGIN;
>>> ALTER TABLE x RENAME TO x_hold;
>>> ALTER TABLE y.x SET SCHEMA a;
>>> ALTER TABLE x OWNER TO foo;
>>> COMMIT;
>>>
>>>
>> Define “transactionally safe”.
>>
>
> Any open transactions will still see the original tables.
>
>

That would involve locking, most DDL simply won’t happen while open
transactions are using the objects. Normal visibility semantics then apply
beyond that - which depend on isolation level.

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Raj 2026-05-18 11:01:14 Pgbouncer transaction pool mode
Previous Message Ron Johnson 2026-05-15 01:03:47 Re: Are these metadata ALTER TABLE commands transactionally safe?