| From: | Nathan Bossart <nathan(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Teach pg_upgrade to skip invalid databases. |
| Date: | 2026-11-05 20:28:30 |
| Message-ID: | E1xP44V-00000000MKC-0SOf@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Teach pg_upgrade to skip invalid databases.
If DROP DATABASE is interrupted at the wrong moment, it leaves the
pg_database row behind, but it is marked as invalid, i.e.,
datconnlimit is set to -2. Such databases cannot be connected to,
and there is no supported recovery mechanism (besides of course
restoring a backup to a time before the DROP DATABASE command).
The only thing that a user can do is run DROP DATABASE on them
again.
Currently, pg_upgrade checks for invalid databases and refuses to
proceed if any exist. This commit teaches pg_upgrade to instead
simply skip them. The pg_database row and any associated files
won't be transferred; the invalid database will just cease to exist
on the newly upgraded cluster. We should probably try to
automatically drop invalid databases during normal operation, too,
but that is left as a future exercise.
Author: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Discussion: https://postgr.es/m/CALj2ACV3jSPaMCSRQ8XZTN_meZezNyySpMJVhVBZy_qDJK2mmQ%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/37a7664a9204a7fafa04553e906aa0ae9f4a91c3
Modified Files
--------------
src/bin/pg_upgrade/check.c | 43 +++++++++++++++-----------------
src/bin/pg_upgrade/info.c | 5 ++--
src/bin/pg_upgrade/t/002_pg_upgrade.pl | 45 +++++-----------------------------
3 files changed, 29 insertions(+), 64 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Daniel Gustafsson | 2026-11-05 20:47:59 | pgsql: oauth: Reject quoted empty string in validator config |
| Previous Message | Heikki Linnakangas | 2026-11-05 15:10:39 | pgsql: Remove obsolete comment from AddBufferToRing() |