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 <[email protected]> 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(-)
