diff options
author | Amjith Ramanujam <amjith@newrelic.com> | 2015-01-04 16:04:21 -0800 |
---|---|---|
committer | Amjith Ramanujam <amjith@newrelic.com> | 2015-01-04 16:04:21 -0800 |
commit | c9109090d7dc3460e045fdfafecc08ad861bc959 (patch) | |
tree | 9f85a00c62058cbe3cd8108d91c4f7740b6aa1f3 | |
parent | bca8e2ef4a139f0772f0a32ce228d1d12442159d (diff) |
Copy databases query from psql.
-rw-r--r-- | pgcli/pgexecute.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py index 61c363fe..3f0a55ee 100644 --- a/pgcli/pgexecute.py +++ b/pgcli/pgexecute.py @@ -59,7 +59,14 @@ class PGExecute(object): columns_query = '''SELECT column_name FROM information_schema.columns WHERE table_name =%s;''' - databases_query = '''SELECT datname FROM pg_database;''' + databases_query = """SELECT d.datname as "Name", + pg_catalog.pg_get_userbyid(d.datdba) as "Owner", + pg_catalog.pg_encoding_to_char(d.encoding) as "Encoding", + d.datcollate as "Collate", + d.datctype as "Ctype", + pg_catalog.array_to_string(d.datacl, E'\n') AS "Access privileges" + FROM pg_catalog.pg_database d + ORDER BY 1;""" def __init__(self, database, user, password, host, port): (self.dbname, self.user, self.password, self.host, self.port) = \ |