@@ -896,19 +896,6 @@ dropdb(const char *dbname, bool missing_ok)
896
896
nslots_active , nslots_active )));
897
897
}
898
898
899
- /*
900
- * Check for other backends in the target database. (Because we hold the
901
- * database lock, no new ones can start after this.)
902
- *
903
- * As in CREATE DATABASE, check this after other error conditions.
904
- */
905
- if (CountOtherDBBackends (db_id , & notherbackends , & npreparedxacts ))
906
- ereport (ERROR ,
907
- (errcode (ERRCODE_OBJECT_IN_USE ),
908
- errmsg ("database \"%s\" is being accessed by other users" ,
909
- dbname ),
910
- errdetail_busy_db (notherbackends , npreparedxacts )));
911
-
912
899
/*
913
900
* Check if there are subscriptions defined in the target database.
914
901
*
@@ -924,6 +911,19 @@ dropdb(const char *dbname, bool missing_ok)
924
911
"There are %d subscriptions." ,
925
912
nsubscriptions , nsubscriptions )));
926
913
914
+ /*
915
+ * Check for other backends in the target database. (Because we hold the
916
+ * database lock, no new ones can start after this.)
917
+ *
918
+ * As in CREATE DATABASE, check this after other error conditions.
919
+ */
920
+ if (CountOtherDBBackends (db_id , & notherbackends , & npreparedxacts ))
921
+ ereport (ERROR ,
922
+ (errcode (ERRCODE_OBJECT_IN_USE ),
923
+ errmsg ("database \"%s\" is being accessed by other users" ,
924
+ dbname ),
925
+ errdetail_busy_db (notherbackends , npreparedxacts )));
926
+
927
927
/*
928
928
* Remove the database's tuple from pg_database.
929
929
*/
0 commit comments