On Fri, 2023-02-17 at 12:50 -0800, Andres Freund wrote: > I think we just drop/recreate template1 and postgres during > pg_upgrade.
Thank you, that makes much more sense now. I was confused because pg_upgrade loops through to check compatibility with all the databases, which makes zero sense if it's going to drop all of them except template0 anyway. The checks on template1/postgres should be bypassed. So the two approaches are: 1. Don't bother with locale provider compatibility checks at all (even on template0). The emitted CREATE DATABASE statements already specify the locale provider, so that will take care of everything except template0. Maybe the locale provider of template0 shouldn't matter, but some users might be surprised if it changes during upgrade. It also raises some questions about the other properties of template0 like encoding, lc_collate, and lc_ctype, which also don't matter a whole lot (because they can all be changed when using template0 as a template). 2. Update the pg_database entry for template0. This has less potential for surprise in case people are actually using template0 for a template. -- Jeff Davis PostgreSQL Contributor Team - AWS