public inbox for pgsql-admin@postgresql.org  
help / color / mirror / Atom feed
From: David G. Johnston <david.g.johnston@gmail.com>
To: Ron Johnson <ronljohnsonjr@gmail.com>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Are these metadata ALTER TABLE commands transactionally safe?
Date: Thu, 14 May 2026 18:13:03 -0700
Message-ID: <CAKFQuwYNKr8_ro8_-jwbfxwGaOWrA9e7-9E3+1mboMAPnR-V+w@mail.gmail.com> (raw)
In-Reply-To: <CANzqJaAqg37Q7HM6uo=BRE2c6_==kawD8EBO6og_MbTp-ayo4w@mail.gmail.com>
References: <CANzqJaB2NCCvyigAWH3=1G=2A-oybCo-oQXxWF4UuniCebqhPQ@mail.gmail.com>
	<CAKFQuwbZQ6nquZaw3Xoa2GyFa0_kGzmuVAH71LN7tO-z+sAoAA@mail.gmail.com>
	<CANzqJaAqg37Q7HM6uo=BRE2c6_==kawD8EBO6og_MbTp-ayo4w@mail.gmail.com>

On Thursday, May 14, 2026, Ron Johnson <ronljohnsonjr@gmail.com> wrote:

> On Thu, May 14, 2026 at 5:26 PM David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>
>> On Thursday, May 14, 2026, Ron Johnson <ronljohnsonjr@gmail.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.


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: david.g.johnston@gmail.com, ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: Are these metadata ALTER TABLE commands transactionally safe?
  In-Reply-To: <CAKFQuwYNKr8_ro8_-jwbfxwGaOWrA9e7-9E3+1mboMAPnR-V+w@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox