Detect and terminate local connections
This commit is contained in:
parent
054ac3928e
commit
ebc48e3615
1 changed files with 1 additions and 1 deletions
|
@ -46,7 +46,7 @@ func (db *Db) Sessions() (sessions []Session) {
|
||||||
query := fmt.Sprintf(`select pid as pid,
|
query := fmt.Sprintf(`select pid as pid,
|
||||||
usename as user,
|
usename as user,
|
||||||
datname as db,
|
datname as db,
|
||||||
host(client_addr)::text || ':' || client_port::text as client,
|
coalesce(host(client_addr)::text || ':' || client_port::text, 'localhost') as client,
|
||||||
state as state, substring(query from 1 for %d) as query,
|
state as state, substring(query from 1 for %d) as query,
|
||||||
coalesce(extract(epoch from now() - state_change), 0) as "stateDuration"
|
coalesce(extract(epoch from now() - state_change), 0) as "stateDuration"
|
||||||
from pg_catalog.pg_stat_activity
|
from pg_catalog.pg_stat_activity
|
||||||
|
|
Loading…
Reference in a new issue