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]

 



pgsql stores table names in pg_class.relname, column names in
pg_attribute.attname.
Read the document and you can get the solution.

"Emi Lu" <emilu@xxxxxxxxxxxxxxx> 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
>



---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

[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