File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -147,6 +147,24 @@ SELECT
147147 NULL ::text AS client_addr,
148148 NULL ::int AS client_port;
149149
150+ [terminate_backends:transient:column]
151+ -- Terminate all except mine.
152+ SELECT
153+ procpid, pg_catalog .pg_terminate_backend (procpid)
154+ FROM
155+ pg_catalog .pg_stat_activity
156+ WHERE
157+ procpid != pg_catalog .pg_backend_pid ()
158+
159+ [cancel_backends:transient:column]
160+ -- Cancel all except mine.
161+ SELECT
162+ procpid, pg_catalog .pg_cancel_backend (procpid)
163+ FROM
164+ pg_catalog .pg_stat_activity
165+ WHERE
166+ procpid != pg_catalog .pg_backend_pid ()
167+
150168[sizeof_db:transient:first]
151169SELECT pg_catalog .pg_database_size (current_database())::bigint
152170
Original file line number Diff line number Diff line change @@ -56,9 +56,12 @@ def incontext(*args, **kw):
5656 incontext .__name__ = n
5757 return incontext
5858
59- def reset (self ):
60- # Don't reset if it's not the initializing process.
59+ def destroy (self ):
60+ # Don't destroy if it's not the initializing process.
6161 if os .getpid () == self ._init_pid_ :
62+ with self :
63+ # Kill all the open connections.
64+ db .sys .terminate_backends ()
6265 cluster = self .cluster
6366 self .cluster = None
6467 self ._init_pid_ = None
@@ -80,7 +83,7 @@ def init(self,
8083 # Hasn't been created yet, but doesn't matter.
8184 # On exit, obliterate the cluster directory.
8285 self ._init_pid_ = os .getpid ()
83- atexit .register (self .reset )
86+ atexit .register (self .destroy )
8487
8588 # [$HOME|.]/.pg_tmpdb_{pid}
8689 self .cluster_path = os .path .join (
You can’t perform that action at this time.
0 commit comments