Re: How to get the primary key fields? - Mailing list pgsql-general

From Robert Treat
Subject Re: How to get the primary key fields?
Date
Msg-id 1034968214.22016.18.camel@camel
Whole thread Raw
In response to How to get the primary key fields?  ("Roberto (SmartBit)" <roberto@smartbit.inf.br>)
List pgsql-general
SELECT c2.relname
FROM pg_class c, pg_class c2, pg_index i
WHERE c.relname = 'rms_users' AND c.oid = i.indrelid AND i.indexrelid =
c2.oid
AND i.indisprimary AND i.indisunique ORDER BY c2.relname

Robert Treat

On Fri, 2002-10-18 at 12:37, Roberto (SmartBit) wrote:
> Hi all
>
> how could I do a single select resulting a list of field name that are
> primary keys of a table??
>
> please, help me
>
> tia
>
> Roberto Amorim
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly




pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: PostgreSQL Benchmarks
Next
From: Andrei Ivanov
Date:
Subject: creating a new type in C