Re: How to detect primary key of a table

From: "Sergey Karin" <sergey(dot)karin(at)gmail(dot)com>
To: "Michael Kleiser" <Michael(dot)Kleiser(at)combots(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to detect primary key of a table
Date: 2006-03-30 11:25:51
Message-ID: b78883bf0603300325m18778b67l92e0a13332e55d46@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)Kleiser(at)combots(dot)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(at)postgresql(dot)org
> [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Sergey Karin
> Sent: Thursday, March 30, 2006 1:13 PM
> To: pgsql-general(at)postgresql(dot)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
>
>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2006-03-30 11:30:56 Re: How to detect primary key of a table
Previous Message Peter Nixonn 2006-03-30 11:24:55 converting timstamptz to local time zone