View Single Post

   
  #1 (permalink)  
Old 04-10-2008, 05:46 AM
=?iso-8859-1?Q?D=FCster_Horst?=
 
Posts: n/a
Default query to select the table primary key column name

I'm looking out for a system catalog query to select the primary key column
name for a specific table. With the following query I only get the name of
the primary key itself. How do I get the primary key column name???

select pg_constraint.*,pg_index.indisprimary
from pg_constraint,pg_namespace, pg_class, pg_index
where pg_namespace.nspname='public'
and pg_namespace.oid=c.connamespace
and pg_class.relname='new_layer'
and pg_class.oid=c.conrelid
and pg_class.oid=pg_index.indrelid
and c.contype='p'

I'll appeciate any help.

with best regards

Dr. Horst Düster

Kanton Solothurn*
Amt für Geoinformation
Abteilung SO!GIS Koordination
Rötistrasse 4
CH-4501 Solothurn

Tel.: ++41 (0)32 627 25 32
Fax: ++41 (0)32 627 22 14

horst.duester@bd.so.ch
www.sogis.so.ch


---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org

Reply With Quote