TABLES:-
SELECT table_schema, table_name, table_type FROM information_schema.tables ORDER BY table_schema, table_name;
FUNCTIONS:
SELECT routine_schema, routine_name FROM information_schema.routines WHERE routine_type = 'FUNCTION' ORDER BY routine_schema, routine_name;
ALL OBJECTS
SELECT n.nspname as schema_name,
c.relname as object_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 't' THEN 'TOAST table'
WHEN 'f' THEN 'foreign table'
WHEN 'p' THEN 'partitioned table'
WHEN 'I' THEN 'partitioned index'
END as object_type
FROM pg_catalog.pg_class c
JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY schema_name, object_type, object_name;
Comments
Post a Comment