pub const LIST_DATABASES: &str = r#"
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"
from pg_catalog.pg_database d
order by 1;
"#;
pub const LIST_TABLES: &str = r#"
select
n.nspname as "schema",
c.relname as "name",
case c.relkind when 'r' then 'table' when 'v' then 'view' when 'm' then 'materialized view' when 'i' then 'index' when 's' then 'sequence' when 's' then 'special' when 'f' then 'foreign table' when 'p' then 'table' when 'i' then 'index' end as "type",
pg_catalog.pg_get_userbyid(c.relowner) as "owner"
from pg_catalog.pg_class c
left join pg_catalog.pg_namespace n on n.oid = c.relnamespace
where c.relkind in ('r','p','')
and n.nspname <> 'pg_catalog'
and n.nspname <> 'information_schema'
and n.nspname !~ '^pg_toast'
and pg_catalog.pg_table_is_visible(c.oid)
order by 1,2;
"#;