Search columns in Postgres


Aug 25, 2020
featured image

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;
 
    

postgres sql dev