From: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com> |
---|---|
To: | Emi Lu <emilu(at)cs(dot)concordia(dot)ca> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Get all table names that have a specific column |
Date: | 2005-10-04 13:40:36 |
Message-ID: | 20051004134035.GX40138@pervasive.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Easy way:
SELECT table_name FROM information_schema.columns WHERE column_name = ''
or
SELECT table_name FROM pg_sysviews.pg_user_table_columns WHERE
column_name = ''
If those don't work, select from pg_attribute a join pg_class c on
(c.oid = a.reloid)
On Fri, Sep 30, 2005 at 10:55:44AM -0400, Emi Lu wrote:
> Greetings,
>
> I am not very familiar with the system views/tables in postgreSQL. I'd
> like to get all table names that have a column let's say named "col1".
>
> For example,
> t1 (... col1 varchar(3) ... )
> t2 (... col1 varchar(3) ... )
> t3 (... ...)
>
>
> After querying the system tables/views, I can get the result something
> like :
>
> tables contain column "col1"
> ---------------------------------------------
> t1
> t2
> (2 rows)
>
>
> Thanks a lot,
> Emi
>
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org
>
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
From | Date | Subject | |
---|---|---|---|
Next Message | Jim C. Nasby | 2005-10-04 13:51:45 | Re: Maximum # of schemas |
Previous Message | Greg Campbell | 2005-10-04 13:34:14 | Re: [ODBC] Unbound text box, Text > 255 characters, MSAccess/PostgreSQL |