Re: getting attribute names, types

Поиск
Список
Период
Сортировка
От Michael Fuhr
Тема Re: getting attribute names, types
Дата
Msg-id 20050307035056.GA23219@winnie.fuhr.org
обсуждение исходный текст
Ответ на getting attribute names, types  ("Surabhi Ahuja " <surabhi.ahuja@iiitb.ac.in>)
Список pgsql-general
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/

В списке pgsql-general по дате отправления:

Предыдущее
От: "Greg Sabino Mullane"
Дата:
Сообщение: Re: Error: "catalog is missing 8 attribute(s) for relid 16683"
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Pg 8.01 big trouble with LIMIT (bug !?)