Skip to content

Commit ad224a4

Browse files
committed
sort databases in report tool
1 parent d919dd3 commit ad224a4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mamonsu/tools/report/pgsql.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ class PostgresInfo(object):
102102
then pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))
103103
else 'No Access'
104104
end,
105+
case when pg_catalog.has_database_privilege(d.datname, 'CONNECT')
106+
then pg_catalog.pg_database_size(d.datname)::text
107+
else 'No Access'
108+
end,
105109
pg_catalog.pg_get_userbyid(d.datdba),
106110
pg_catalog.pg_encoding_to_char(d.encoding),
107111
d.datcollate,
@@ -111,8 +115,8 @@ class PostgresInfo(object):
111115
pg_catalog.shobj_description(d.oid, 'pg_database')
112116
from pg_catalog.pg_database d
113117
join pg_catalog.pg_tablespace t on d.dattablespace = t.oid
114-
order by 1""",
115-
('name', 'size', 'owner', 'encoding', 'collate',
118+
order by 2""",
119+
('name', 'size', 'size_b', 'owner', 'encoding', 'collate',
116120
'ctype', 'privileges', 'tablespace', 'description')
117121
)
118122

0 commit comments

Comments
 (0)