diff options
Diffstat (limited to 'src/bin/pg_dump/pg_dump.c')
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 56 |
1 files changed, 31 insertions, 25 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 10cbf02bebd..23e6217b73f 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -2984,7 +2984,7 @@ dumpDatabase(Archive *fout) i_datlocprovider, i_collate, i_ctype, - i_daticulocale, + i_datlocale, i_daticurules, i_frozenxid, i_minmxid, @@ -3003,7 +3003,7 @@ dumpDatabase(Archive *fout) *datlocprovider, *collate, *ctype, - *iculocale, + *locale, *icurules, *datistemplate, *datconnlimit, @@ -3027,10 +3027,12 @@ dumpDatabase(Archive *fout) appendPQExpBufferStr(dbQry, "datminmxid, "); else appendPQExpBufferStr(dbQry, "0 AS datminmxid, "); - if (fout->remoteVersion >= 150000) - appendPQExpBufferStr(dbQry, "datlocprovider, daticulocale, datcollversion, "); + if (fout->remoteVersion >= 170000) + appendPQExpBufferStr(dbQry, "datlocprovider, datlocale, datcollversion, "); + else if (fout->remoteVersion >= 150000) + appendPQExpBufferStr(dbQry, "datlocprovider, daticulocale AS datlocale, datcollversion, "); else - appendPQExpBufferStr(dbQry, "'c' AS datlocprovider, NULL AS daticulocale, NULL AS datcollversion, "); + appendPQExpBufferStr(dbQry, "'c' AS datlocprovider, NULL AS datlocale, NULL AS datcollversion, "); if (fout->remoteVersion >= 160000) appendPQExpBufferStr(dbQry, "daticurules, "); else @@ -3051,7 +3053,7 @@ dumpDatabase(Archive *fout) i_datlocprovider = PQfnumber(res, "datlocprovider"); i_collate = PQfnumber(res, "datcollate"); i_ctype = PQfnumber(res, "datctype"); - i_daticulocale = PQfnumber(res, "daticulocale"); + i_datlocale = PQfnumber(res, "datlocale"); i_daticurules = PQfnumber(res, "daticurules"); i_frozenxid = PQfnumber(res, "datfrozenxid"); i_minmxid = PQfnumber(res, "datminmxid"); @@ -3070,10 +3072,10 @@ dumpDatabase(Archive *fout) datlocprovider = PQgetvalue(res, 0, i_datlocprovider); collate = PQgetvalue(res, 0, i_collate); ctype = PQgetvalue(res, 0, i_ctype); - if (!PQgetisnull(res, 0, i_daticulocale)) - iculocale = PQgetvalue(res, 0, i_daticulocale); + if (!PQgetisnull(res, 0, i_datlocale)) + locale = PQgetvalue(res, 0, i_datlocale); else - iculocale = NULL; + locale = NULL; if (!PQgetisnull(res, 0, i_daticurules)) icurules = PQgetvalue(res, 0, i_daticurules); else @@ -3138,11 +3140,12 @@ dumpDatabase(Archive *fout) appendStringLiteralAH(creaQry, ctype, fout); } } - if (iculocale) + if (locale) { appendPQExpBufferStr(creaQry, " ICU_LOCALE = "); - appendStringLiteralAH(creaQry, iculocale, fout); + appendStringLiteralAH(creaQry, locale, fout); } + if (icurules) { appendPQExpBufferStr(creaQry, " ICU_RULES = "); @@ -13756,12 +13759,12 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) int i_collisdeterministic; int i_collcollate; int i_collctype; - int i_colliculocale; + int i_colllocale; int i_collicurules; const char *collprovider; const char *collcollate; const char *collctype; - const char *colliculocale; + const char *colllocale; const char *collicurules; /* Do nothing in data-only dump */ @@ -13793,12 +13796,15 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) appendPQExpBufferStr(query, "true AS collisdeterministic, "); - if (fout->remoteVersion >= 150000) + if (fout->remoteVersion >= 170000) + appendPQExpBufferStr(query, + "colllocale, "); + else if (fout->remoteVersion >= 150000) appendPQExpBufferStr(query, - "colliculocale, "); + "colliculocale AS colllocale, "); else appendPQExpBufferStr(query, - "NULL AS colliculocale, "); + "NULL AS colllocale, "); if (fout->remoteVersion >= 160000) appendPQExpBufferStr(query, @@ -13820,7 +13826,7 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) i_collisdeterministic = PQfnumber(res, "collisdeterministic"); i_collcollate = PQfnumber(res, "collcollate"); i_collctype = PQfnumber(res, "collctype"); - i_colliculocale = PQfnumber(res, "colliculocale"); + i_colllocale = PQfnumber(res, "colllocale"); i_collicurules = PQfnumber(res, "collicurules"); collprovider = PQgetvalue(res, 0, i_collprovider); @@ -13847,10 +13853,10 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) collctype = NULL; } - if (!PQgetisnull(res, 0, i_colliculocale)) - colliculocale = PQgetvalue(res, 0, i_colliculocale); + if (!PQgetisnull(res, 0, i_colllocale)) + colllocale = PQgetvalue(res, 0, i_colllocale); else - colliculocale = NULL; + colllocale = NULL; if (!PQgetisnull(res, 0, i_collicurules)) collicurules = PQgetvalue(res, 0, i_collicurules); @@ -13880,7 +13886,7 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) if (collprovider[0] == 'd') { - if (collcollate || collctype || colliculocale || collicurules) + if (collcollate || collctype || colllocale || collicurules) pg_log_warning("invalid collation \"%s\"", qcollname); /* no locale -- the default collation cannot be reloaded anyway */ @@ -13889,16 +13895,16 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) { if (fout->remoteVersion >= 150000) { - if (collcollate || collctype || !colliculocale) + if (collcollate || collctype || !colllocale) pg_log_warning("invalid collation \"%s\"", qcollname); appendPQExpBufferStr(q, ", locale = "); - appendStringLiteralAH(q, colliculocale ? colliculocale : "", + appendStringLiteralAH(q, colllocale ? colllocale : "", fout); } else { - if (!collcollate || !collctype || colliculocale || + if (!collcollate || !collctype || colllocale || strcmp(collcollate, collctype) != 0) pg_log_warning("invalid collation \"%s\"", qcollname); @@ -13914,7 +13920,7 @@ dumpCollation(Archive *fout, const CollInfo *collinfo) } else if (collprovider[0] == 'c') { - if (colliculocale || collicurules || !collcollate || !collctype) + if (colllocale || collicurules || !collcollate || !collctype) pg_log_warning("invalid collation \"%s\"", qcollname); if (collcollate && collctype && strcmp(collcollate, collctype) == 0) |