Re: Primary Key

From: Thomas Swan <tswan-lst(at)ics(dot)olemiss(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "P(dot) Dwayne Miller" <dmiller(at)espgroup(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Primary Key
Date: 2001-06-19 22:37:58
Message-ID: 3B2FD446.9060506@ics.olemiss.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

>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 null
> msgtext | 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.
>
I've been using the syntax "PRIMARY KEY (/column_name/ [, /column_name/
])," without the constraint name, and the "/COLUMN_NAME TYPE/ PRIMARY
KEY" syntax for sometime now. I may be admitting to SQL heresy in
saying that; but, that's the syntax I've seen in MySQL and in quite a
few SQL/database books.

AFIAK, it's a legal table creation statement.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-06-19 22:50:39 Re: Primary Key
Previous Message P. Dwayne Miller 2001-06-19 22:11:12 Re: Primary Key