Re: Teach pg_upgrade to deal with invalid databases

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Robert Treat <rob(at)xzilla(dot)net>
Subject: Re: Teach pg_upgrade to deal with invalid databases
Date: 2026-09-04 17:54:07
Message-ID: apsFv3w7VCBM7Cub@nathan
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2026-09-04 18:02:02 Re: REPACK (CONCURRENTLY) rewrites tables marked with user_catalog_table
Previous Message Bharath Rupireddy 2026-09-04 17:27:00 Teach pg_upgrade to deal with invalid databases