File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -277,7 +277,8 @@ public SQLConnection createDatabase(PostgresGlobalState globalState) throws SQLE
277
277
globalState .getState ().logStatement (String .format ("\\ c %s;" , entryDatabaseName ));
278
278
279
279
String dropCommand = "DROP DATABASE" ;
280
- if (Randomly .getBoolean ()) {
280
+ boolean forceDrop = Randomly .getBoolean ();
281
+ if (forceDrop ) {
281
282
dropCommand += " FORCE" ;
282
283
}
283
284
dropCommand += " IF EXISTS " + databaseName ;
@@ -287,7 +288,7 @@ public SQLConnection createDatabase(PostgresGlobalState globalState) throws SQLE
287
288
s .execute (dropCommand );
288
289
} catch (SQLException e ) {
289
290
// If force fails, fall back to regular drop
290
- if (dropCommand . contains ( "FORCE" ) ) {
291
+ if (forceDrop ) {
291
292
String fallbackDrop = "DROP DATABASE IF EXISTS " + databaseName ;
292
293
globalState .getState ().logStatement (fallbackDrop + ";" );
293
294
try (Statement s = con .createStatement ()) {
You can’t perform that action at this time.
0 commit comments