Search Postgresql Archives

Re: getting attribute names, types

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

 



On Thu, Mar 03, 2005 at 03:01:10PM +0530, Surabhi Ahuja  wrote:

>  i have to write a program in C++ using libpq. The program
> establishes a connection with the desired database.
> I have 4 tables in the database. Now i want to get the list of
> attribute names, their data types for each of those 4 tables. how
> do i do that?

You could query the system catalogs or the Information Schema (the
latter available in 7.4 and later).  Another way would be to query
the tables themselves and use the functions described under "Retrieving
Query Result Information" in the libpq documentation.

http://www.postgresql.org/docs/8.0/interactive/catalogs.html
http://www.postgresql.org/docs/8.0/interactive/information-schema.html
http://www.postgresql.org/docs/8.0/interactive/libpq-exec.html#LIBPQ-EXEC-SELECT-INFO

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

[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