PostgreSQL: Temporarily disable connections

后端 未结 5 1810
我在风中等你
我在风中等你 2020-12-14 00:50

I have a script in PostgreSQL which restores test database from dump every night. The database is accessed by app servers and processes with connection pool which keeps a fe

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-14 01:14

    I had a different usage scenario, in which I wanted to disable a DB for everyone (including superuser) and forever, but not plainly drop it just yet, to be able to reactivate it quickly if needed.

    This worked fine on an old 8.3 Postgres:

    UPDATE pg_database SET datallowconn=false WHERE datname='my_db_name';
    

提交回复
热议问题