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/info.c | |
parent | 81d13a8dc066e571dca032da0a5fc1d81214d2bb (diff) | |
download | postgresql-f696c0cd5f299f1b51e214efc55a22a782cc175d.tar.gz postgresql-f696c0cd5f299f1b51e214efc55a22a782cc175d.zip |
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/info.c')
-rw-r--r-- | src/bin/pg_upgrade/info.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/bin/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c index 183c2f84eb4..b5b8d116027 100644 --- a/src/bin/pg_upgrade/info.c +++ b/src/bin/pg_upgrade/info.c @@ -328,18 +328,24 @@ get_template0_info(ClusterInfo *cluster) int i_datlocprovider; int i_datcollate; int i_datctype; - int i_daticulocale; + int i_datlocale; - if (GET_MAJOR_VERSION(cluster->major_version) >= 1500) + if (GET_MAJOR_VERSION(cluster->major_version) >= 1700) dbres = executeQueryOrDie(conn, "SELECT encoding, datlocprovider, " - " datcollate, datctype, daticulocale " + " datcollate, datctype, datlocale " + "FROM pg_catalog.pg_database " + "WHERE datname='template0'"); + else if (GET_MAJOR_VERSION(cluster->major_version) >= 1500) + dbres = executeQueryOrDie(conn, + "SELECT encoding, datlocprovider, " + " datcollate, datctype, daticulocale AS datlocale " "FROM pg_catalog.pg_database " "WHERE datname='template0'"); else dbres = executeQueryOrDie(conn, "SELECT encoding, 'c' AS datlocprovider, " - " datcollate, datctype, NULL AS daticulocale " + " datcollate, datctype, NULL AS datlocale " "FROM pg_catalog.pg_database " "WHERE datname='template0'"); @@ -353,16 +359,16 @@ get_template0_info(ClusterInfo *cluster) i_datlocprovider = PQfnumber(dbres, "datlocprovider"); i_datcollate = PQfnumber(dbres, "datcollate"); i_datctype = PQfnumber(dbres, "datctype"); - i_daticulocale = PQfnumber(dbres, "daticulocale"); + i_datlocale = PQfnumber(dbres, "datlocale"); locale->db_encoding = atoi(PQgetvalue(dbres, 0, i_datencoding)); locale->db_collprovider = PQgetvalue(dbres, 0, i_datlocprovider)[0]; locale->db_collate = pg_strdup(PQgetvalue(dbres, 0, i_datcollate)); locale->db_ctype = pg_strdup(PQgetvalue(dbres, 0, i_datctype)); - if (PQgetisnull(dbres, 0, i_daticulocale)) - locale->db_iculocale = NULL; + if (PQgetisnull(dbres, 0, i_datlocale)) + locale->db_locale = NULL; else - locale->db_iculocale = pg_strdup(PQgetvalue(dbres, 0, i_daticulocale)); + locale->db_locale = pg_strdup(PQgetvalue(dbres, 0, i_datlocale)); cluster->template0 = locale; @@ -392,12 +398,15 @@ get_db_infos(ClusterInfo *cluster) snprintf(query, sizeof(query), "SELECT d.oid, d.datname, d.encoding, d.datcollate, d.datctype, "); - if (GET_MAJOR_VERSION(cluster->major_version) < 1500) + if (GET_MAJOR_VERSION(cluster->major_version) >= 1700) + snprintf(query + strlen(query), sizeof(query) - strlen(query), + "datlocprovider, datlocale, "); + else if (GET_MAJOR_VERSION(cluster->major_version) >= 1500) snprintf(query + strlen(query), sizeof(query) - strlen(query), - "'c' AS datlocprovider, NULL AS daticulocale, "); + "datlocprovider, daticulocale AS datlocale, "); else snprintf(query + strlen(query), sizeof(query) - strlen(query), - "datlocprovider, daticulocale, "); + "'c' AS datlocprovider, NULL AS datlocale, "); snprintf(query + strlen(query), sizeof(query) - strlen(query), "pg_catalog.pg_tablespace_location(t.oid) AS spclocation " "FROM pg_catalog.pg_database d " |