Search Postgresql Archives

Re: Get all table names that have a specific column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
_______________________________

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux