user1198582
user1198582

Reputation:

What's wrong with my CREATE TABLE command?

I'm following the instructions from this document. My exact version is 8.4.4.

This is what I try to do

CREATE TABLE testInfo (
               testNo integer PRIMARY KEY,
               product varchar(15),
               firmware varchar(15),
               startDate date,
               eta date
);

NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "testinfo_pkey" for table "testinfo"

It totally ignores my PRIMARY KEY constraint. I don't see whay this isn't essentially the same as the example in the docs.

CREATE TABLE products (
product_no integer PRIMARY KEY,
name text,
price numeric

)

I'm sure the obvious is staring me right in the face. Nevertheless I would appreciate any help offered.

Update: I just tried the example from the documentation, returns the same message. So may I conclude the documentation is in error, or that 8.4.4 is buggy?

Upvotes: 0

Views: 95

Answers (2)

jmoreno
jmoreno

Reputation: 13571

It's not ignoring your primary key, it's telling you the mechanism it will use to enforce it. This message can be disabled with client_min_messages (warning).

Upvotes: 1

Larry Lustig
Larry Lustig

Reputation: 50998

I'm no Postgresql expert, but it appears the message is simply to inform you that an INDEX is being created to assist in the implementation of the PRIMARY KEY that you defined.

Upvotes: 3

Related Questions