Re: pgAdmin 4 - auto disconnect

From: Paolo Saudin <paolosaudin(at)gmail(dot)com>
To: Melvin Davidson <melvin6925(at)gmail(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: pgAdmin 4 - auto disconnect
Date: 2016-12-20 19:01:32
Message-ID: CADtZQgmGNZG038SqWzecof7Labg-SDtYFSfpfsgGvRWYOV3mUA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thank you very much,
I will try this approach
Paolo

2016-12-19 15:30 GMT+01:00 Melvin Davidson <melvin6925(at)gmail(dot)com>:

>
> On Mon, Dec 19, 2016 at 7:28 AM, Paolo Saudin <paolosaudin(at)gmail(dot)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.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Gaetano Mendola 2016-12-20 20:32:19 Re: pg_repack and Postgres versions > 9.4
Previous Message Adrian Klaver 2016-12-20 15:17:35 Re: Replacing an existing unique constraint (not UNIQUE INDEX) with primary key