Re: Primary Key - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Primary Key
Date
Msg-id 1616.992986464@sss.pgh.pa.us
Whole thread Raw
In response to Primary Key  ("P. Dwayne Miller" <dmiller@espgroup.net>)
List pgsql-hackers
"P. Dwayne Miller" <dmiller@espgroup.net> writes:
> CREATE TABLE message
> (
>   int4 msgid not null,
>   text msgtext,
>   CONSTRAINT cons_001_pk PRIMARY KEY on (msgid)
> );

> The first two actually create a PRIMARY KEY on msgid.  The third seems
> to have a PRIMARY KEY on 'oid', not 'msgid', though it does create a
> unique index on 'msgid'.

After fixing the several obvious syntax errors, it works fine for me:

regression=# CREATE TABLE message
regression-# (
regression(#   msgid int4 not null,
regression(#   msgtext text,
regression(#   CONSTRAINT cons_001_pk PRIMARY KEY (msgid)
regression(# );
NOTICE:  CREATE TABLE/PRIMARY KEY will create implicit index 'cons_001_pk' for table 'message'
CREATE
regression=# \d message       Table "message"Attribute |  Type   | Modifier
-----------+---------+----------msgid     | integer | not nullmsgtext   | text    |
Primary Key: cons_001_pk

regression=#

Is Cold Fusion perhaps doing strange things to the query behind your
back?  None of those CREATE TABLE commands are legal SQL according
to my references.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Ross J. Reedstrom"
Date:
Subject: Re: vacuum
Next
From: "P. Dwayne Miller"
Date:
Subject: Re: Primary Key