Re: find all tables with a specific column name? - Mailing list pgsql-sql

From Ben K.
Subject Re: find all tables with a specific column name?
Date
Msg-id Pine.GSO.4.64.0604221559200.21736@coe.tamu.edu
Whole thread Raw
In response to Re: find all tables with a specific column name?  (Jeff Frost <jeff@frostconsultingllc.com>)
List pgsql-sql
>>> Is there a reasonable way to extract a list of all tables which contain a
>>> specific column name from the system views on 8.1?
>>> For instance, I might want to enumerate all tables with a column named
>>> last_modified.

This is nothing new but if I may, may I add for this thread's completeness 
a try from internal tables?

select a.relkind, a.relname from pg_class a inner join pg_attribute b on 
a.relfilenode = b.attrelid group by a.relkind, a.relname, 
a.relfilenode,b.attname having b.attname='IID';

The result didn't match the one from the information_schema.tables - the 
above query included indexes too (relkind=i) while 
information_schema.tables included only tables and views (r,v).


Ben K.
Developer
http://benix.tamu.edu


pgsql-sql by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Porting application with rules and triggers from PG 7.4.x
Next
From: Wiebe Cazemier
Date:
Subject: Re: Primary key reference count