Re: find all tables with a specific column name?

From: "Ben K(dot)" <bkim(at)coe(dot)tamu(dot)edu>
To: Jeff Frost <jeff(at)frostconsultingllc(dot)com>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, pgsql-sql(at)postgresql(dot)org
Subject: Re: find all tables with a specific column name?
Date: 2006-04-22 21:37:07
Message-ID: Pine.GSO.4.64.0604221559200.21736@coe.tamu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message A. R. Van Hook 2006-04-23 12:55:54 date array
Previous Message WillemF 2006-04-22 08:47:35 Re: Moving around in a SQL database