public inbox for [email protected]  
help / color / mirror / Atom feed
From: Greg Sabino Mullane <[email protected]>
To: Marcelo Fernandes <[email protected]>
Cc: Adrian Klaver <[email protected]>
Cc: Dominique Devienne <[email protected]>
Cc: [email protected]
Subject: Re: Best Approach for Swapping a Table with its Copy
Date: Sun, 16 Feb 2025 18:48:43 -0500
Message-ID: <CAKAnmm+aGX9_HMbJQrGR8nwFbd60x4NqfexnYi22-wtrCT-cXw@mail.gmail.com> (raw)
In-Reply-To: <CAM2F1VNJaxm9SpPJbBSPeWdcvCT+A+xC1NTa54E7MDgUrKgkgQ@mail.gmail.com>
References: <CAM2F1VP9nn0F6fSjbmhJCNSjv-dbAJcAytZ2HkTkZ0dGYZvxrw@mail.gmail.com>
	<[email protected]>
	<CAM2F1VOOn1izCrtcrDx4YUtCY-H64Vj5yvN5H1Lhk8kCY+_W6Q@mail.gmail.com>
	<[email protected]>
	<CAM2F1VONo8M9gcybhmf8-CdmRUC2QrFGZkZLYF-+uLZuhRKaxQ@mail.gmail.com>
	<[email protected]>
	<CAM2F1VMdDSxLhccn=0pXriJrR6a7Oe9Kir1DB_0pW1v88bsvCg@mail.gmail.com>
	<CAKAnmmJ04kH_gWR+cOFWD0h63RDck1k6hqQYH8K30-cfCvtO_Q@mail.gmail.com>
	<CAFCRh-9xC0CXKM2GTQBfjYY5GQx29Uit+fY5PpBFTvX927YC8w@mail.gmail.com>
	<[email protected]>
	<CAM2F1VMApyPvdA4ERoF7Fob6CXimgOWMKC1vayO5OQa3TtJAFQ@mail.gmail.com>
	<CAM2F1VNnm_x5F7xSKcv6x-hQHY-zxvFgyAdrdwTaQ9ZTVUQ3pQ@mail.gmail.com>
	<CAKAnmmJ0=9m3gXvjvWVAbyJpU=Uopn1K5sQDOPWJG7GNRctPmg@mail.gmail.com>
	<CAM2F1VNJaxm9SpPJbBSPeWdcvCT+A+xC1NTa54E7MDgUrKgkgQ@mail.gmail.com>

On Sun, Feb 16, 2025 at 5:58 PM Marcelo Fernandes <[email protected]>
wrote:

> - The foreign keys are not being updated to point to the new table.
>

You started out okay with your test script, but the pg_depend bit needs
work. I would recommend examining that table closely until you have a
really good understanding of how it works - both on the objid and refobjid
side. Create and modify tables and see how the pg_depend entries change.
Hint: Try it with and without foreign keys.

https://www.postgresql.org/docs/current/catalog-pg-depend.html


> - pg_repack seems to update relcache entries. I am not sure how to do that
> with SQL.


Yes, as I mentioned upthread, the safest thing will probably be a restart.

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support


view thread (13+ messages)

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Best Approach for Swapping a Table with its Copy
  In-Reply-To: <CAKAnmm+aGX9_HMbJQrGR8nwFbd60x4NqfexnYi22-wtrCT-cXw@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