select c.relnamespace::regnamespace as schema_name, c.relname as table_name, i.indexrelid::regclass as index_name, i.indisprimary as is_pk, i.indisunique as is_uniquefrom pg_index ijoin pg_class c on c.oid = i.indrelidwhere c.relname ='TABLE_NAME'
List all indexes for a table
select*from pg_indexes where tablename ='TABLE_NAME'
List all column types across the schema
SELECT n.nspname AS schema_name, t.typname AS type_name, t.typtype AS type_type, t.typcategory AS type_categoryFROM pg_type tJOIN pg_namespace n ON t.typnamespace = n.oidWHERE n.nspname NOT IN ('pg_catalog', 'information_schema') AND t.typtype IN ('e', 'c'); -- 'e' for ENUM, 'c' for composite types