1
2DROP DATABASE base_de_datos;
3
4// SI SALE ESTE MESAJE DE ERROR HAGA LOS PASOS QUE ESTAN A CONTINUACION
5ERROR: database "base_de_datos" is being accessed by other users
6SQL state: 55006
7Detail: There is 1 other session using the database.
8----------------------------------------------------------------------
9
10// primer paso ---------------------------------
11SELECT *
12FROM pg_stat_activity
13WHERE datname = 'base_de_datos';
14
15//segundo paso --------------------------------
16SELECT
17 pg_terminate_backend (pg_stat_activity.pid)
18FROM
19 pg_stat_activity
20WHERE
21 pg_stat_activity.datname = 'base_de_datos';
22
23// tercer paso --------------------------------
24DROP DATABASE 'base_de_datos';
25
26// retira las comillas si no funciona
27DROP DATABASE base_de_datos;