Re: How to detect primary key of a table - Mailing list pgsql-general

From Sergey Karin
Subject Re: How to detect primary key of a table
Date
Msg-id b78883bf0603300325m18778b67l92e0a13332e55d46@mail.gmail.com
Whole thread Raw
In response to How to detect primary key of a table  ("Sergey Karin" <sergey.karin@gmail.com>)
Responses Re: How to detect primary key of a table  (Tino Wildenhain <tino@wildenhain.de>)
List pgsql-general

Yes, it is not a problem via psql.

But I want to detect primary key via libpq (e.g using select commands)


2006/3/30, Michael Kleiser < Michael.Kleiser@combots.com>:
\d your_table
will show it


>> create table foobar ( foo int primary key, bar int );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"foobar_pkey" for table "foobar"
CREATE TABLE

>> \d foobar
    Table "public.foobar"
Column |  Type   | Modifiers
--------+---------+-----------
foo    | integer | not null
bar    | integer |
Indexes:
    "foobar_pkey" PRIMARY KEY, btree (foo)

________________________________

From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Sergey Karin
Sent: Thursday, March 30, 2006 1:13 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] How to detect primary key of a table


Hi, List!

I use PG8.1

Are there any abilities to detect primary key of a table?

Sergey Karin


pgsql-general by date:

Previous
From: Peter Nixonn
Date:
Subject: converting timstamptz to local time zone
Next
From: Tino Wildenhain
Date:
Subject: Re: How to detect primary key of a table