Обсуждение: BUG #16606: V 4.25: unable to drop database

Поиск
Список
Период
Сортировка

BUG #16606: V 4.25: unable to drop database

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      16606
Logged by:          G. Borri
Email address:      g.borri@nemesix.it
PostgreSQL version: 10.14
Operating system:   ubuntu 18.04 desktop 64bit
Description:

Hi, after several attempts, I tried the system just started.
So I opened pgAdmin, insert my admin pwd, opened the server tree till the
database I need to delete.
Right click on the db name and then click on Delete/Drop database, then
click on OK on the confirm request. 
After some seconds this error appear: The database is in use, there is 1
session client.

Before the last update I was always able to delete the databases in this way


Re: BUG #16606: V 4.25: unable to drop database

От
Alexander Korotkov
Дата:
Hi!

On Thu, Sep 3, 2020 at 11:46 AM PG Bug reporting form
<noreply@postgresql.org> wrote:
> The following bug has been logged on the website:
>
> Bug reference:      16606
> Logged by:          G. Borri
> Email address:      g.borri@nemesix.it
> PostgreSQL version: 10.14
> Operating system:   ubuntu 18.04 desktop 64bit
> Description:
>
> Hi, after several attempts, I tried the system just started.
> So I opened pgAdmin, insert my admin pwd, opened the server tree till the
> database I need to delete.
> Right click on the db name and then click on Delete/Drop database, then
> click on OK on the confirm request.
> After some seconds this error appear: The database is in use, there is 1
> session client.

Yes, it's not possible to drop the PostgreSQL database, while there is
another session using it.  You can check the session, which uses the
database, by querying pg_stat_activity view.

SELECT * FROM pg_stat_activity WHERE datname = 'postgres' AND pid <>
pg_backend_pid();

> Before the last update I was always able to delete the databases in this way

This behavior wasn't changed in PostgreSQL 10.  But you might be
interested that there is a FORCE option for DROP TABLE [1] in
PostgreSQL 13, which will be released soon.

Links
1. https://www.postgresql.org/docs/13/sql-dropdatabase.html

------
Regards,
Alexander Korotkov