reading table metadata from pl/pgsql in 8.2 under FreeBSD

Поиск
Список
Период
Сортировка
От David Monarchi
Тема reading table metadata from pl/pgsql in 8.2 under FreeBSD
Дата
Msg-id eea51fdb0705221320x35b50d75x800bc28550253b4a@mail.gmail.com
обсуждение исходный текст
Ответы Re: reading table metadata from pl/pgsql in 8.2 under FreeBSD  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
Hi -

My apologies in advance if this is in the archives/documentation.  I may not have used the correct search terms in trying to find the answer.

I've looked at the system tables, particularly pg_tables, pg_class, and pg_attribute.  In oder to access the attributes for a particular table using the pg_attribute table, I need the oid for the table, specifically the pg_class.oid. 

Looking at some tables, I believe that relfilenode is the the OID of the table.  The corresponding field (i.e., foreign key) in pg_attribute is attrelid.  So far so good.  My problem is that in the pg_class table I don't know how to determine which entries are tables.  And in the pg_attribute table I don't know how to determine which of the corresponding rows are attributes.  (My current rule of thumb to identify an attribute is that in pg_attribute, the defined columns have attnum > 0; all others have attnum <0. )

Thanks for any advice/suggestions.

david

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: How Do You Do a Three Way Join?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: reading table metadata from pl/pgsql in 8.2 under FreeBSD