Re: System catalog and identifying

Поиск
Список
Период
Сортировка
От ville80@salo.salonseutu.fi (9902468)
Тема Re: System catalog and identifying
Дата
Msg-id c8493963.0208012233.33cf808f@posting.google.com
обсуждение исходный текст
Список pgsql-general
I got the solution to that problem a few moments after I had posted
the message...

If one has to identify users colums from a table without knowing their
names, use this approach:

In system catalog pg_attribute you have a description of each column,
and attnum identifies if column is a system column or not.If column is
a systemn column it's attnum is negative, if user column, positive.

So to get all user columns from table which attrelid is 25217 use the
following clause:

select attname from pg_attribute where attrelid = '25217' and attnum >
'0';

You can fetch attrelid like this:

select relfilenode from pg_class where relname =
'your_table_name_here';

Now, how one can tell if a column is the primary key column of the
table?

If you know please respond...

Thanks

-9902468

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

Предыдущее
От: "Zeb Fropiaz"
Дата:
Сообщение: Recursion in SQL
Следующее
От: "Ron Harter"
Дата:
Сообщение: Temporal Database