Re: Teach pg_upgrade to deal with invalid databases - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: Teach pg_upgrade to deal with invalid databases
Date
Msg-id apsFv3w7VCBM7Cub@nathan
Whole thread
In response to Teach pg_upgrade to deal with invalid databases  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
List pgsql-hackers
On Fri, Sep 04, 2026 at 10:27:00AM -0700, Bharath Rupireddy wrote:
> I would like to propose an option to skip the invalid databases, with
> the default being on. This helps unblock upgrade workflows while still
> preserving them for users who think it is necessary. Please find the
> attached patch doing this.

IMHO if we are going to have an option, we'd better default it to off,
because there's probably a low chance of someone remembering to set it.
But I'm not totally convinced we even need an option.  The user has already
decided to drop the database, and IIUC there's no supported recovery
mechanism to revive a database marked invalid.  In the previous thread, it
was argued that pg_upgrade doesn't fix things and instead leaves it up to
the user.  While I understand the argument, I also don't really see the
harm in letting pg_upgrade fix this particular problem on the fly.

> Dropping the invalid databases during the upgrade is another approach,
> but it could be costly, especially with large buffer pools and a large
> number of files to unlink. Skipping them instead is simpler, and the
> old directory contents would be cleaned up by the removal script that
> pg_upgrade already generates.

Does dropping the invalid databases provide any advantages here?  I can't
think of any.

-- 
nathan



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Teach pg_upgrade to deal with invalid databases
Next
From: Andrey Borodin
Date:
Subject: Re: Fix XLogFileReadAnyTLI silently applying divergent WAL from wrong timeline