• Heikki Linnakangas's avatar
    Change the way encoding and locale checks are done in pg_upgrade. · 33755e8e
    Heikki Linnakangas authored
    Lc_collate and lc_ctype have been per-database settings since server version
    8.4, but pg_upgrade was still treating them as cluster-wide options. It
    fetched the values for the template0 databases in old and new cluster, and
    compared them. That's backwards; the encoding and locale of the template0
    database doesn't matter, as template0 is guaranteed to contain only ASCII
    characters. But if there are any other databases that exist on both clusters
    (in particular template1 and postgres databases), their encodings and
    locales must be compatible.
    
    Also, make the locale comparison more lenient. If the locale names are not
    equal, try to canonicalize both of them by passing them to setlocale(). We
    used to do that only when upgrading from 9.1 or below, but it seems like a
    good idea even with newer versions. If we change the canonical form of a
    locale, this allows pg_upgrade to still work. I'm about to do just that to
    fix bug #11431, by mapping a locale name that contains non-ASCII characters
    to a pure-ASCII alias of the same locale.
    
    No backpatching, because earlier versions of pg_upgrade still support
    upgrading from 8.3 servers. That would be more complicated, so it doesn't
    seem worth it, given that we haven't received any complaints about this
    from users.
    33755e8e
pg_upgrade.h 13.5 KB