Re: [GENERAL] pgAdmin 4 - auto disconnect

Поиск
Список
Период
Сортировка
От Melvin Davidson
Тема Re: [GENERAL] pgAdmin 4 - auto disconnect
Дата
Msg-id CANu8FiwssteothTH56=hAfJiafRSzPfCquBSu=KxMib+29HzEQ@mail.gmail.com
обсуждение исходный текст
Ответ на [GENERAL] pgAdmin 4 - auto disconnect  (Paolo Saudin <paolosaudin@gmail.com>)
Ответы Re: [GENERAL] pgAdmin 4 - auto disconnect
Список pgsql-general

On Mon, Dec 19, 2016 at 7:28 AM, Paolo Saudin <paolosaudin@gmail.com> wrote:
Hi,

I deployed pgAdmin4 on a server and I have a script that every day restore a database from a dump file. The problem I am facing at, is that if somebody forget to diconnect from the database, the restore command fails with an error "database Test is being accessed by other users".

Is there a way to tell pgAdmin to auto disconnect from all databases?

Thanks
Paolo Saudin

PgAdmin4 actually has nothing to do with it, as it is nothing more than a tool to monitor PostgreSQL.
However, you can kill all user processes (except your own) by submitting the following query.

SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE pg_backend_pid() <> pid;

CAVEAT EMPTOR: You must be a superuser for this to work properly.

--
Melvin Davidson
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.

В списке pgsql-general по дате отправления:

Предыдущее
От: Mickaël Le Baillif
Дата:
Сообщение: [GENERAL] JSON objects merge using || operator
Следующее
От: Poul Kristensen
Дата:
Сообщение: [GENERAL] pg_hba.conf debugging or logging when using ldag to authenticate