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