Re: Move defaults toward ICU in 16? - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Move defaults toward ICU in 16?
Date
Msg-id 20230217205009.4sy4lmmqanbhjsgb@awork3.anarazel.de
Whole thread Raw
In response to Re: Move defaults toward ICU in 16?  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: Move defaults toward ICU in 16?
List pgsql-hackers
Hi,

On 2023-02-17 12:36:05 -0800, Jeff Davis wrote:
> > > There's already a check that the new cluster is empty, so I think
> > > it's
> > > safe to hack the pg_database locale fields.
> > 
> > I don't think we need to, we do issue the CREATE DATABASEs. So we
> > just need to
> > make sure that includes the collation provider info, and the proper
> > template
> > database, in pg_upgrade mode.
> 
> We must fixup template1/postgres in the new cluster (change it to libc
> to match the old cluster), because any objects existing in those
> databases in the old cluster may depend on the default collation. I
> don't see how we can do that without updating pg_database, so I'm not
> following your point.

I think we just drop/recreate template1 and postgres during pg_upgrade.  Yep,
looks like it. See create_new_objects():

        /*
         * template1 database will already exist in the target installation,
         * so tell pg_restore to drop and recreate it; otherwise we would fail
         * to propagate its database-level properties.
         */
        create_opts = "--clean --create";

and then:

        /*
         * postgres database will already exist in the target installation, so
         * tell pg_restore to drop and recreate it; otherwise we would fail to
         * propagate its database-level properties.
         */
        if (strcmp(old_db->db_name, "postgres") == 0)
            create_opts = "--clean --create";
        else
            create_opts = "--create";

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: The output sql generated by pg_dump for a create function refers to a modified table name
Next
From: Daniel Gustafsson
Date:
Subject: Reducing connection overhead in pg_upgrade compat check phase