Search Postgresql Archives

Re: How to detect primary key of a table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxx>:
\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@xxxxxxxxxxxxxx
[mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of Sergey Karin
Sent: Thursday, March 30, 2006 1:13 PM
To: pgsql-general@xxxxxxxxxxxxxx
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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux