Re: how to save primary key constraints

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: how to save primary key constraints
Дата
Msg-id 4E94B541.3050708@hogranch.com
обсуждение исходный текст
Ответ на how to save primary key constraints  ("J.V." <jvsrvcs@gmail.com>)
Ответы Re: how to save primary key constraints
Список pgsql-general
On 10/11/11 2:16 PM, J.V. wrote:
> I need to be able to query for all primary keys and save the table
> name and the name of the primary key field into some structure that I
> can iterate through later.
>
> How would I go about this?  I want to hard code the number of tables
> and be able to iterate through some structure to get the table name
> and the primary key field.

that info is all in pg_catalog... pg_tables is a view of all tables...
if you left join that with pg_index qualified by indisprimary, you'll
probably get what you need.  you'll probably need to join pg_namespace
to get the index name from its oid.



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


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

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: how to call a stored function from another stored function? even possible?
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: libpq 8.3 and 8.4 interfaces