Re: Teach pg_upgrade to deal with invalid databases

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Robert Treat <rob(at)xzilla(dot)net>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Rithvika Devisetti <devisettirithvika(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Teach pg_upgrade to deal with invalid databases
Date: 2026-10-16 21:25:07
Message-ID: CALj2ACUVJrXn=nwW_+mgRuyZfR+MesOKP1SnBAj82naimDw0fQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Oct 6, 2026 at 11:32 AM Robert Treat <rob(at)xzilla(dot)net> wrote:
>
> > > Thanks. IMHO we shouldn't bother adding a note to pg_upgrade's
> > > documentation, or even emitting warnings when pg_upgrade skips invalid
> > > databases.
>
> > Upon thinking more on this, I agree on both. Unless there are
> > objections, I will drop the warning and the doc note in the next
> > version.
>
> > I also think not reporting them matches what other tools do, like
> > pg_dumpall (dumpDatabases()), vacuumdb (vacuum_all_databases()),
> > reindexdb (reindex_all_databases()), etc. They skip invalid databases
> > without emitting any info, and their docs don't mention it either.
>
> I guess I don't object, but it feels a little odd to make a user
> visible behavioral change without giving any kinds of heads up; this
> would have errored out in previous versions, now it "just works", but
> just works might look concerning if a database that used to show up in
> your database list now goes missing, or you are wondering why your
> cluster size dropped significantly after upgrade. There are some other
> weird corner cases that might come up too,

Other tools silently ignoring the invalid databases worked fine so far
(unless I'm missing anything here), so it shouldn't be a big problem
IMHO.

> but hopefully the release
> note entry will be enough for people looking for explanations.

Yes, this will help.

Please find the attached v3 patch dropping the docs note and the
warning. I self-reviewed it and fixed a couple of things: excluded
invalid databases while checking encodings and global names on the old
cluster, and reworded the commit message.

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment Content-Type Size
v3-0001-Teach-pg_upgrade-to-skip-invalid-databases.patch application/x-patch 11.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2026-10-16 21:26:42 Re: pg_*_advice: tsv load failure, etc.
Previous Message Zsolt Parragi 2026-10-16 21:09:26 [PG19] pg_upgrade transfers temporal keys using gist_inet_ops with the wrong opclass