Retrieve the primary key of a table
От | Alejandro |
---|---|
Тема | Retrieve the primary key of a table |
Дата | |
Msg-id | 86eeef650908021924q3012d8e6saabfcda70349850b@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Retrieve the primary key of a table
Re: Retrieve the primary key of a table Re: Retrieve the primary key of a table |
Список | pgsql-novice |
Hi. I need to retrieve the primary key of a table and their value.
I tried with this http://wiki.postgresql.org/wiki/Retrieve_primary_key_columns:
How can I get only the primary key?
I have postgres 8.1.11.
Thanks, Alejandro.
I tried with this http://wiki.postgresql.org/wiki/Retrieve_primary_key_columns:
SELECTBut this shows indexes too. http://wiki.postgresql.org/wiki/Talk:Retrieve_primary_key_columns
pg_attribute.attname,
format_type(pg_attribute.atttypid, pg_attribute.atttypmod)
FROM pg_index, pg_class, pg_attribute
WHERE
pg_class.oid = 'TABLENAME'::regclass AND
indrelid = pg_class.oid AND
pg_attribute.attrelid = pg_class.oid AND
pg_attribute.attnum = any(pg_index.indkey);
How can I get only the primary key?
I have postgres 8.1.11.
Thanks, Alejandro.
В списке pgsql-novice по дате отправления: