Where's The Primary Key?

From: "Jim Louis" <jim(dot)louis(at)worldnet(dot)att(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Where's The Primary Key?
Date: 2003-07-25 07:13:27
Message-ID: 000401c3527c$4a94e480$3201a8c0@meadow.prv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I'm new to Postgresql and having trouble finding some familiar ground. I'm
on Redhat 7.2, and using Postgresql 7.1.3 (I think). Postgresql was
installed with the operating system with no "help" on my part.

I've created a simple table as shown below and can't find any indication
that the primary key was created. I would expect the \d meta-command to
show the primary key. (pgaccess also indicates that there is no primary key
defined.) I've tried this with a column constraint, a table constraint,
with and without the constraint name, and a few other variants. All had the
same results. Is the key really there? Shouldn't I see it? Am I doing it
wrong or thinking about it wrong?

I'd appreciate any help to get me kick-started.

db01=> CREATE TABLE junk_t (
db01(> idx int CONSTRAINT junk_idx PRIMARY KEY,
db01(> dat int
db01(> );
NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'junk_idx' for
table 'junk_t'
CREATE

db01=> \d junk_t
Table "junk_t"
Attribute | Type | Modifier
-----------+---------+----------
idx | integer | not null
dat | integer |
Index: junk_idx

db01=>

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Dag Gullberg 2003-07-25 09:06:00 Re: question about images
Previous Message HK 2003-07-25 05:47:13 Get the last record alone from the select statement.