class PgConn::SessionMethods

def list(database)

users
nil, it returns a list of database/username tuples for all connected
Returns a list of users connected to the given database. If database is
def list(database)
  if database
    conn.values "select usename from pg_stat_activity where datname = '#{database}'"
  else
    conn.tuples %(
      select datname, usename
      from pg_stat_activity
      where datname is not null and usename is not null
    )
  end
end