Delete database from pgAdmin

Can’t delete the database in pgAdmin. The Delete menu item is missing when right-clicking with the mouse. Other databases have this item. Object->Disconnect database menu is not active.

Is this defaultdb? Possibly there is another active connection caused by background tasks and monitoring? I was able to force it via psql:

autosuggest=> DROP DATABASE defaultdb;
ERROR:  database "defaultdb" is being accessed by other users
DETAIL:  There is 1 other session using the database.

autosuggest=> DROP DATABASE defaultdb WITH (FORCE);
DROP DATABASE

However, this leads to the failure of cron tasks:

[pg-...]2024-05-26T18:00:41.341813[postgresql-16][42-1] pid=99069,user=avnadmin,db=autosuggest,app=psql,client=... LOG: TimescaleDB background worker scheduler for database 16423 will be stopped
[pg-...]2024-05-26T18:00:41.342469[postgresql-16][42-2] pid=99069,user=avnadmin,db=autosuggest,app=psql,client=... STATEMENT: drop database defaultdb WITH (FORCE);
[pg-...]2024-05-26T18:00:41.349520[postgresql-16][12-1] pid=1324,user=,db=,app=,client= LOG: pg_cron scheduler shutting down
[pg-...]2024-05-26T18:00:41.355957[postgresql-16][509-1] pid=1131,user=,db=,app=,client= LOG: background worker "pg_cron launcher" (PID 1324) exited with exit code 1
[pg-...]2024-05-26T18:00:41.449811[postgresql-16][938-1] pid=1146,user=,db=,app=,client= LOG: checkpoint starting: immediate force wait
[pg-...]2024-05-26T18:00:41.486055[postgresql-16][939-1] pid=1146,user=,db=,app=,client= LOG: checkpoint complete: wrote 284 buffers (1.2%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.022 s, sync=0.008 s, total=0.035 s; sync files=8, longest=0.007 s, average=0.001 s; distance=32219 kB, estimate=48311 kB; lsn=8/36085C18, redo lsn=8/36085BE0
[pg-...]2024-05-26T18:00:42.362681[postgresql-16][510-1] pid=2141564,user=,db=,app=,client= FATAL: database "defaultdb" does not exist
[pg-...]2024-05-26T18:00:42.370929[postgresql-16][510-1] pid=1131,user=,db=,app=,client= LOG: background worker "pg_cron launcher" (PID 2141564) exited with exit code 1

After a few seconds it appears to be recreated by the management agent:

[pg-...]2024-05-26T18:00:51.929648[postgresql-16][521-1] pid=2141627,user=postgres,db=_aiven,app=[unknown],client=[local] LOG: connection authorized: user=postgres database=_aiven application_name=management-agent
[pg-...]2024-05-26T18:00:52.724576[postgresql-16][521-1] pid=2141629,user=,db=,app=,client= FATAL: database "template0" is not currently accepting connections
[pg-...]2024-05-26T18:00:52.734546[postgresql-16][521-1] pid=1131,user=,db=,app=,client= LOG: background worker "TimescaleDB Background Worker Scheduler" (PID 2141629) exited with exit code 1
[pg-...]2024-05-26T18:00:53.484411[postgresql-16][522-1] pid=2141636,user=,db=,app=,client= LOG: pg_cron scheduler started
[pg-...]2024-05-26T18:00:55.323528[postgresql-16][522-1] pid=2141647,user=[unknown],db=[unknown],app=[unknown],client=[local] LOG: connection received: host=[local]
[pg-...]2024-05-26T18:00:55.324645[postgresql-16][523-1] pid=2141647,user=postgres,db=defaultdb,app=[unknown],client=[local] LOG: connection authorized: user=postgres database=defaultdb application_name=management-agent
[pg-...]2024-05-26T18:00:55.337546[postgresql-16][524-1] pid=2141647,user=postgres,db=defaultdb,app=management-agent,client=[local] LOG: disconnection: session time: 0:00:00.014 user=postgres database=defaultdb host=[local]
1 Like