postgres=# select relname,
CASE c.relkind
WHEN 'r' THEN 'table'
WHEN 'i' THEN 'index'
WHEN 'S' THEN 'sequence'
WHEN 't' THEN 'TOAST table'
WHEN 'v' THEN 'view'
WHEN 'm' THEN 'materialized view'
WHEN 'c' THEN 'composite type'
WHEN 'f' THEN 'foreign table'
WHEN 'P' THEN 'partitioned table'
WHEN 'I' THEN 'partitioned index'
END as "Type"
from pg_class c
order by 2 desc
;
relname | Type
------------------------------------------------+----------------
pg_stat_sys_tables | view
pg_stat_xact_all_tables | view
pg_stat_all_tables | view
pg_timezone_names | view
pg_timezone_abbrevs | view
pg_seclabels | view
pg_prepared_statements | view
pg_stat_progress_vacuum | view
pg_stat_progress_analyze | view
pg_stat_wal | view
pg_stat_io | view
pg_shadow | view
pg_roles | view
pg_hba_file_rules | view
pg_settings | view
pg_file_settings | view
pg_backend_memory_contexts | view
pg_ident_file_mappings | view
pg_config | view
postgres=# select relname,
CASE c.relkind
WHEN 'r' THEN 'table'
WHEN 'i' THEN 'index'
WHEN 'S' THEN 'sequence'
WHEN 't' THEN 'TOAST table'
WHEN 'v' THEN 'view'
WHEN 'm' THEN 'materialized view'
WHEN 'c' THEN 'composite type'
WHEN 'f' THEN 'foreign table'
WHEN 'P' THEN 'partitioned table'
WHEN 'I' THEN 'partitioned index'
END as "Type",relnamespace
from pg_class c where relnamespace not in (11,13238,99,32910)
order by 2 desc
;
relname | Type | relnamespace
-------------------------+-------+--------------
pg_stat_statements | view | 2200
pg_stat_statements_info | view | 2200
t | table | 2200
tbl_article | table | 2200
dept | table | 2200
emp | table | 2200
stu | table | 2200
item | table | 2200
t1 | table | 2200
test1 | table | 2200
t_n | index | 2200
(11 rows)