From: Nathan Bossart <nathandbossart@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Hannu Krosing <hannuk@google.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Horribly slow pg_upgrade performance with many Large Objects
Date: Tue, 8 Apr 2025 13:39:45 -0500
Message-ID: <Z_VtcQxi_i78-yjg@nathan> (raw)
In-Reply-To: <4054965.1744134140@sss.pgh.pa.us>
References: <Z_RO37whB1L2LbiD@nathan>
<CAMT0RQRL08=Si+9V7RW7VKcbo2H7GO6ME3opkS_WHpE8qctBLg@mail.gmail.com>
<Z_VE4Q4A2nNCX3Ny@nathan>
<4044567.1744128814@sss.pgh.pa.us>
<CAMT0RQSALxZ2DJbq0b5cy+cvmpVxkawmv7c+qTWYObubZVr+2g@mail.gmail.com>
<4047312.1744130263@sss.pgh.pa.us>
<Z_VTucTiS01p-d6z@nathan>
<4050387.1744132029@sss.pgh.pa.us>
<Z_VbON4DZn0wPvUN@nathan>
<4054965.1744134140@sss.pgh.pa.us>
On Tue, Apr 08, 2025 at 01:42:20PM -0400, Tom Lane wrote:
> Nathan Bossart <nathandbossart@gmail.com> writes:
>> Unless I'm missing something, we don't seem to have had any dependency
>> handling before commit 12a53c7. Was that broken before we moved to SQL
>> commands?
>
> Sounds like it :-(
Huh. Sure enough, it seems to be lost during an upgrade from 9.6 to 10.
v9.6:
postgres=# select lo_from_bytea(1234, '1234');
lo_from_bytea
---------------
1234
(1 row)
postgres=# create role bob;
CREATE ROLE
postgres=# grant select on large object 1234 to bob;
GRANT
postgres=# drop role bob;
ERROR: role "bob" cannot be dropped because some objects depend on it
DETAIL: privileges for large object 1234
v10 (upgraded from v9.6):
postgres=# select lo_get(1234);
lo_get
------------
\x31323334
(1 row)
postgres=# drop role bob;
DROP ROLE
If I then try to upgrade that database to v17, it fails like this:
pg_restore: from TOC entry 2422; 0 0 ACL LARGE OBJECT 1234 nathan
pg_restore: error: could not execute query: ERROR: role "16384" does not exist
Command was: GRANT SELECT ON LARGE OBJECT 1234 TO "16384";
I've also verified that the dependency information is carried over in
upgrades to later versions (AFAICT all the supported ones).
--
nathan
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-hackers@postgresql.org
Cc: nathandbossart@gmail.com, tgl@sss.pgh.pa.us, hannuk@google.com, pgsql-hackers@lists.postgresql.org
Subject: Re: Horribly slow pg_upgrade performance with many Large Objects
In-Reply-To: <Z_VtcQxi_i78-yjg@nathan>
* 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