Find table that DON'T have a column with specific name in PostgreSQL database

Databases often have standard columns. Examples of such standard columns can be id, modified_date, created_by or row_version.

Query below finds all tables that do not have a 'last_update' column.


select t.table_schema,
from information_schema.tables t
left join (select table_schema, table_name
           from information_schema.columns
           where column_name = 'last_update') c
                    on c.table_name = t.table_name 
                    and c.table_schema = t.table_schema
where c.table_name is null 
      and t.table_schema not in ('information_schema', 'pg_catalog')
      and t.table_type = 'BASE TABLE'
order by t.table_schema, 


  • table_schema - name of schema of found table
  • table_name - name of found table


  • One row represents a table
  • Scope of rows: all found tables
  • Ordered by schema name

Sample results

These tables do not have a 'last_update' column.

There are no comments. Click here to write the first comment.