Search columns in Postgres

Reading Time: < 1 minute

A simple query to search columns in different schemas

      
SELECT t.table_schema, t.table_name
FROM information_schema.tables t
INNER JOIN information_schema.columns c ON c.table_name = t.table_name and c.table_schema = t.table_schema
WHERE c.column_name = 'my_column'
AND t.table_schema IN ('pg_catalog', 'another_schema')
ORDER BY t.table_schema;
 
    


About the author

Andrés Canavesi
Andrés Canavesi

Software Engineer with 15+ experience in software development, specialized in Salesforce, Java and Node.js.


Join 22 other subscribers

Leave a Reply