try perform instead of select
This commit is contained in:
parent
203f24c279
commit
bdecf9bbd1
@ -46,7 +46,7 @@ public class PgSqlDatabaseProcessorFactory implements EntityProcessorFactory {
|
|||||||
assert db.getInstance().equals("pgsql");
|
assert db.getInstance().equals("pgsql");
|
||||||
JDBCProcessor aJDBCP = createPostgreSqlAdminProcessor();
|
JDBCProcessor aJDBCP = createPostgreSqlAdminProcessor();
|
||||||
String aName = AbstractEntity.escapeString(db.getName());
|
String aName = AbstractEntity.escapeString(db.getName());
|
||||||
aJDBCP.addSQL("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='" + aName + "'");
|
aJDBCP.addSQL("PERFORM pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname='" + aName + "'");
|
||||||
aJDBCP.addSQL("DROP DATABASE " + aName);
|
aJDBCP.addSQL("DROP DATABASE " + aName);
|
||||||
return aJDBCP;
|
return aJDBCP;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ public class PgSqlUserProcessorFactory implements EntityProcessorFactory {
|
|||||||
assert dbu.getInstance().equals("pgsql");
|
assert dbu.getInstance().equals("pgsql");
|
||||||
JDBCProcessor aJDBCP = PgSqlDatabaseProcessorFactory.createPostgreSqlAdminProcessor();
|
JDBCProcessor aJDBCP = PgSqlDatabaseProcessorFactory.createPostgreSqlAdminProcessor();
|
||||||
String aName = AbstractEntity.escapeString(dbu.getName());
|
String aName = AbstractEntity.escapeString(dbu.getName());
|
||||||
aJDBCP.addSQL("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE usename='" + aName + "'");
|
aJDBCP.addSQL("PERFORM pg_terminate_backend(pid) FROM pg_stat_activity WHERE usename='" + aName + "'");
|
||||||
aJDBCP.addSQL("DROP USER " + aName);
|
aJDBCP.addSQL("DROP USER " + aName);
|
||||||
return aJDBCP;
|
return aJDBCP;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user