Re: Get all table names that have a specific column

Поиск
Список
Период
Сортировка
Искать
От
Bricklen Anderson
Тема
Re: Get all table names that have a specific column
Дата
Msg-id
433D5BAF.307@PresiNET.com
Ответ на
Список
Дерево обсуждения
Re: Get all table names that have a specific column "William ZHANG" <uniware@zedware.org>
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
Check this posting:
http://archives.postgresql.org/pgsql-admin/2005-03/msg00011.php

Query the pga_columns view for the matches that you are looking for.
eg:
select tablename
from pga_columns
where columnname='col1';


-- 
_______________________________

This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.
_______________________________
В списке pgsql-general по дате отправления
От: William ZHANG
Дата:
От: Doug Bloebaum
Дата:
FAQ