@@ -13077,9 +13077,11 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
13077
13077
int i_collisdeterministic;
13078
13078
int i_collcollate;
13079
13079
int i_collctype;
13080
+ int i_colliculocale;
13080
13081
const char *collprovider;
13081
13082
const char *collcollate;
13082
13083
const char *collctype;
13084
+ const char *colliculocale;
13083
13085
13084
13086
/* Do nothing in data-only dump */
13085
13087
if (dopt->dataOnly)
@@ -13110,6 +13112,13 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
13110
13112
appendPQExpBufferStr(query,
13111
13113
"true AS collisdeterministic, ");
13112
13114
13115
+ if (fout->remoteVersion >= 150000)
13116
+ appendPQExpBufferStr(query,
13117
+ "colliculocale, ");
13118
+ else
13119
+ appendPQExpBufferStr(query,
13120
+ "NULL AS colliculocale, ");
13121
+
13113
13122
appendPQExpBuffer(query,
13114
13123
"collcollate, "
13115
13124
"collctype "
@@ -13123,10 +13132,24 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
13123
13132
i_collisdeterministic = PQfnumber(res, "collisdeterministic");
13124
13133
i_collcollate = PQfnumber(res, "collcollate");
13125
13134
i_collctype = PQfnumber(res, "collctype");
13135
+ i_colliculocale = PQfnumber(res, "colliculocale");
13126
13136
13127
13137
collprovider = PQgetvalue(res, 0, i_collprovider);
13128
- collcollate = PQgetvalue(res, 0, i_collcollate);
13129
- collctype = PQgetvalue(res, 0, i_collctype);
13138
+
13139
+ if (!PQgetisnull(res, 0, i_collcollate))
13140
+ collcollate = PQgetvalue(res, 0, i_collcollate);
13141
+ else
13142
+ collcollate = NULL;
13143
+
13144
+ if (!PQgetisnull(res, 0, i_collctype))
13145
+ collctype = PQgetvalue(res, 0, i_collctype);
13146
+ else
13147
+ collctype = NULL;
13148
+
13149
+ if (!PQgetisnull(res, 0, i_colliculocale))
13150
+ colliculocale = PQgetvalue(res, 0, i_colliculocale);
13151
+ else
13152
+ colliculocale = NULL;
13130
13153
13131
13154
appendPQExpBuffer(delq, "DROP COLLATION %s;\n",
13132
13155
fmtQualifiedDumpable(collinfo));
@@ -13149,17 +13172,28 @@ dumpCollation(Archive *fout, const CollInfo *collinfo)
13149
13172
if (strcmp(PQgetvalue(res, 0, i_collisdeterministic), "f") == 0)
13150
13173
appendPQExpBufferStr(q, ", deterministic = false");
13151
13174
13152
- if (strcmp(collcollate, collctype) == 0 )
13175
+ if (colliculocale != NULL )
13153
13176
{
13154
13177
appendPQExpBufferStr(q, ", locale = ");
13155
- appendStringLiteralAH(q, collcollate , fout);
13178
+ appendStringLiteralAH(q, colliculocale , fout);
13156
13179
}
13157
13180
else
13158
13181
{
13159
- appendPQExpBufferStr(q, ", lc_collate = ");
13160
- appendStringLiteralAH(q, collcollate, fout);
13161
- appendPQExpBufferStr(q, ", lc_ctype = ");
13162
- appendStringLiteralAH(q, collctype, fout);
13182
+ Assert(collcollate != NULL);
13183
+ Assert(collctype != NULL);
13184
+
13185
+ if (strcmp(collcollate, collctype) == 0)
13186
+ {
13187
+ appendPQExpBufferStr(q, ", locale = ");
13188
+ appendStringLiteralAH(q, collcollate, fout);
13189
+ }
13190
+ else
13191
+ {
13192
+ appendPQExpBufferStr(q, ", lc_collate = ");
13193
+ appendStringLiteralAH(q, collcollate, fout);
13194
+ appendPQExpBufferStr(q, ", lc_ctype = ");
13195
+ appendStringLiteralAH(q, collctype, fout);
13196
+ }
13163
13197
}
13164
13198
13165
13199
/*
0 commit comments