Skip to content

Commit afbdfe1

Browse files
committed
Add support for Create DB with Locale
1 parent 3d9a5cc commit afbdfe1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/sqlancer/postgres/PostgresProvider.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,9 +340,13 @@ private String getCreateDatabaseCommand(PostgresGlobalState state) {
340340
sb.append(Randomly.fromOptions("utf8"));
341341
sb.append("' ");
342342
}
343-
for (String lc : Arrays.asList("LC_COLLATE", "LC_CTYPE")) {
344-
if (!state.getCollates().isEmpty() && Randomly.getBoolean()) {
345-
sb.append(String.format(" %s = '%s'", lc, Randomly.fromList(state.getCollates())));
343+
if (Randomly.getBoolean() && !state.getCollates().isEmpty()) {
344+
sb.append(String.format(" LOCALE = '%s' ", Randomly.fromList(state.getCollates())));
345+
} else {
346+
for (String lc : Arrays.asList("LC_COLLATE", "LC_CTYPE")) {
347+
if (!state.getCollates().isEmpty() && Randomly.getBoolean()) {
348+
sb.append(String.format(" %s = '%s'", lc, Randomly.fromList(state.getCollates())));
349+
}
346350
}
347351
}
348352
sb.append(" TEMPLATE template0");

0 commit comments

Comments
 (0)