pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nathan Bossart <nathan@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_upgrade: Transfer pg_largeobject_metadata's files when possib
Date: Mon, 08 Sep 2025 19:20:02 +0000
Message-ID: <E1uvhPG-0019uE-2A@gemulon.postgresql.org> (raw)

pg_upgrade: Transfer pg_largeobject_metadata's files when possible.

Commit 161a3e8b68 taught pg_upgrade to use COPY for large object
metadata for upgrades from v12 and newer, which is much faster to
restore than the proper large object commands.  For upgrades from
v16 and newer, we can take this a step further and transfer the
large object metadata files as if they were user tables.  We can't
transfer the files from older versions because the aclitem data
type (needed by pg_largeobject_metadata.lomacl) changed its storage
format in v16 (see commit 7b378237aa).  Note that this commit is
essentially a revert of commit 12a53c732c.

There are a couple of caveats.  First, we still need to COPY the
corresponding pg_shdepend rows for large objects.  Second, we need
to COPY anything in pg_largeobject_metadata with a comment or
security label, else restoring those will fail.  This means that an
upgrade in which every large object has a comment or security label
won't gain anything from this commit, but it should at least avoid
making those unusual use-cases any worse.

pg_upgrade must also take care to transfer the relfilenodes of
pg_largeobject_metadata and its index, as was done for
pg_largeobject in commits d498e052b4 and bbe08b8869.

Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aJ3_Gih_XW1_O2HF%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3bcfcd815e1a2d51772ba27e0d034467f0344f15

Modified Files
--------------
src/backend/commands/tablecmds.c           | 12 +++--
src/bin/pg_dump/pg_dump.c                  | 80 +++++++++++++++++++++++++-----
src/bin/pg_upgrade/Makefile                |  3 +-
src/bin/pg_upgrade/info.c                  | 11 ++--
src/bin/pg_upgrade/pg_upgrade.c            |  6 +--
src/bin/pg_upgrade/t/006_transfer_modes.pl | 67 +++++++++++++++++++++++++
6 files changed, 154 insertions(+), 25 deletions(-)



Message-ID: <E1uvhPG-0019uE-2A@gemulon.postgresql.org>
Permalink:  ../E1uvhPG-0019uE-2A@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1uvhPG-0019uE-2A@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: nathan@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: pg_upgrade: Transfer pg_largeobject_metadata's files when possib
  In-Reply-To: <E1uvhPG-0019uE-2A@gemulon.postgresql.org>

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

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