Preserve relfilenode of pg_largeobject and its index across pg_upgrade.
authorRobert Haas <rhaas@postgresql.org>
Fri, 8 Jul 2022 14:15:19 +0000 (10:15 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 8 Jul 2022 14:20:27 +0000 (10:20 -0400)
commitd498e052b4b84ae21b3b68d5b3fda6ead65d1d4d
tree2f00bb1c97b0cddc585b8925689ea419ce29885b
parentbf1f4a364d6c72cc5c39a6d81d156a0335fdf332
Preserve relfilenode of pg_largeobject and its index across pg_upgrade.

Commit 9a974cbcba005256a19991203583a94b4f9a21a9 did this for user
tables, but pg_upgrade treats pg_largeobject as a user table, and so
needs the same treatment. Without this fix, if you rewrite the
pg_largeobject table and then perform an upgrade with pg_upgrade, the
table will apparently be empty on the new cluster, while all of your
objects will end up with an orphaned file.

With this fix, instead of the old cluster's pg_largeobject files ending
up orphaned, the original files fro the new cluster do. That's mostly
harmless because we expect the table to be empty, but we might want
to arrange to remove the as part of the upgrade. Since we're still
debating the best way of doing that, I (rhaas) have decided to postpone
dealing with that problem and get the basic fix committed.

Justin Pryzby, reviewed by Shruthi Gowda and by me.

Discussion: http://postgr.es/m/20220701231413.GI13040@telsasoft.com
src/bin/pg_dump/pg_dump.c
src/bin/pg_upgrade/t/002_pg_upgrade.pl