Data dictionary
List tables
SELECT * FROM pg_catalog.pg_tables;
List indexes (keep in mind the table names are downcase by default)
SELECT * FROM pg_catalog.pg_indexes WHERE tablename = 'some_table'
List views (aren’t included in a list of tables)
SELECT * FROM pg_catalog.pg_views;
Columns
SELECT *
FROM information_schema.columns
WHERE table_schema = 'some_schema'
AND table_name = 'some_table';
Constraints
SELECT *
FROM information_schema.table_constraints
WHERE table_schema = 'some_schema'
AND table_name = 'some_table'