On Mon, 19 Aug 2024 00:35:39 +0200 Tomas Vondra <to...@vondra.me> wrote:
> On 8/16/24 13:26, Tomas Vondra wrote: > > Hi Ayush, > > > > ... > > > > So this fix seems reasonable. > > > > I've pushed this to all affected branches, except for 11 which is EOL. > > I thought about adding a test, but I couldn't think of a TAP test where > this would really fit, and it didn't seem very practical to have a test > creating hundreds of roles. So I abandoned the idea. I tried to add Assert in heap_inplace_update to prevent possible similar failures, but I gave up because I could not find a good way to determine if a tuple is detoasted of not. By the way, I found a comment in vac_update_datfrozenxid() and EventTriggerOnLogin() that explains why we could not use tuples from the syscache for heap_inplace_update. I think it is better ad d the same comment in dropdb(). I attached a trivial patch for it. Regards, Yugo Nagata -- Yugo Nagata <nag...@sraoss.co.jp>
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 7a7e2c6e3e..d00ae40e19 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -1790,7 +1790,9 @@ dropdb(const char *dbname, bool missing_ok, bool force) pgstat_drop_database(db_id); /* - * Update the database's pg_database tuple + * Get the pg_database tuple to scribble on. Note that this does not + * directly rely on the syscache to avoid issues with flattened toast + * values for the in-place update. */ ScanKeyInit(&scankey, Anum_pg_database_datname,