diff options
author | Jeff Davis <jdavis@postgresql.org> | 2024-03-09 14:48:18 -0800 |
---|---|---|
committer | Jeff Davis <jdavis@postgresql.org> | 2024-03-09 14:48:18 -0800 |
commit | f696c0cd5f299f1b51e214efc55a22a782cc175d (patch) | |
tree | f834ff70d179f4d21f3def9ee8e4c4f1fe4922ad /src/bin/pg_upgrade/pg_upgrade.c | |
parent | 81d13a8dc066e571dca032da0a5fc1d81214d2bb (diff) |
Catalog changes preparing for builtin collation provider.
Rename pg_collation.colliculocale to colllocale, and
pg_database.daticulocale to datlocale. These names reflects that the
fields will be useful for the upcoming builtin provider as well, not
just for ICU.
This is purely a rename; no changes to the meaning of the fields.
Discussion: https://postgr.es/m/ff4c2f2f9c8fc7ca27c1c24ae37ecaeaeaff6b53.camel%40j-davis.com
Reviewed-by: Peter Eisentraut
Diffstat (limited to 'src/bin/pg_upgrade/pg_upgrade.c')
-rw-r--r-- | src/bin/pg_upgrade/pg_upgrade.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c index 10c94a6c1fc..bb261353bdd 100644 --- a/src/bin/pg_upgrade/pg_upgrade.c +++ b/src/bin/pg_upgrade/pg_upgrade.c @@ -391,7 +391,7 @@ setup(char *argv0, bool *live_check) * Copy locale and encoding information into the new cluster's template0. * * We need to copy the encoding, datlocprovider, datcollate, datctype, and - * daticulocale. We don't need datcollversion because that's never set for + * datlocale. We don't need datcollversion because that's never set for * template0. */ static void @@ -400,7 +400,7 @@ set_locale_and_encoding(void) PGconn *conn_new_template1; char *datcollate_literal; char *datctype_literal; - char *daticulocale_literal = NULL; + char *datlocale_literal = NULL; DbLocaleInfo *locale = old_cluster.template0; prep_status("Setting locale and encoding for new cluster"); @@ -414,15 +414,29 @@ set_locale_and_encoding(void) datctype_literal = PQescapeLiteral(conn_new_template1, locale->db_ctype, strlen(locale->db_ctype)); - if (locale->db_iculocale) - daticulocale_literal = PQescapeLiteral(conn_new_template1, - locale->db_iculocale, - strlen(locale->db_iculocale)); + if (locale->db_locale) + datlocale_literal = PQescapeLiteral(conn_new_template1, + locale->db_locale, + strlen(locale->db_locale)); else - daticulocale_literal = pg_strdup("NULL"); + datlocale_literal = pg_strdup("NULL"); /* update template0 in new cluster */ - if (GET_MAJOR_VERSION(new_cluster.major_version) >= 1500) + if (GET_MAJOR_VERSION(new_cluster.major_version) >= 1700) + PQclear(executeQueryOrDie(conn_new_template1, + "UPDATE pg_catalog.pg_database " + " SET encoding = %d, " + " datlocprovider = '%c', " + " datcollate = %s, " + " datctype = %s, " + " datlocale = %s " + " WHERE datname = 'template0' ", + locale->db_encoding, + locale->db_collprovider, + datcollate_literal, + datctype_literal, + datlocale_literal)); + else if (GET_MAJOR_VERSION(new_cluster.major_version) >= 1500) PQclear(executeQueryOrDie(conn_new_template1, "UPDATE pg_catalog.pg_database " " SET encoding = %d, " @@ -435,7 +449,7 @@ set_locale_and_encoding(void) locale->db_collprovider, datcollate_literal, datctype_literal, - daticulocale_literal)); + datlocale_literal)); else PQclear(executeQueryOrDie(conn_new_template1, "UPDATE pg_catalog.pg_database " @@ -449,7 +463,7 @@ set_locale_and_encoding(void) PQfreemem(datcollate_literal); PQfreemem(datctype_literal); - PQfreemem(daticulocale_literal); + PQfreemem(datlocale_literal); PQfinish(conn_new_template1); |