avi
avi

Reputation: 1846

Postgresql how do i find a table based on column name?

I know that I have a table with the column "fortyid" but I cant remember which table it is and I have like 350 tables in my database. Is there a way to find all tables that has "fortyid" as column? (doesn't matter the type)

Upvotes: 1

Views: 37

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269753

You can use the metadata defined by the SQL standard, specifically INFORMATION_SCHEMA.COLUMNS.

select c.*
from information_schema.columns c
where c.column_name = 'fortyid';

Upvotes: 6

Related Questions