Detect and terminate local connections

This commit is contained in:
Julien Riou 2018-07-08 19:44:24 +02:00
parent 054ac3928e
commit ebc48e3615
No known key found for this signature in database
GPG key ID: BA3E15176E45E85D

View file

@ -46,7 +46,7 @@ func (db *Db) Sessions() (sessions []Session) {
query := fmt.Sprintf(`select pid as pid,
usename as user,
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,
coalesce(extract(epoch from now() - state_change), 0) as "stateDuration"
from pg_catalog.pg_stat_activity