From: | BRINER Cedric <work(at)infomaniak(dot)ch> |
---|---|
To: | postgres <pgsql-general(at)postgresql(dot)org> |
Subject: | create synopsis wrong ? |
Date: | 2004-05-04 07:06:15 |
Message-ID: | 409740E7.6020609@infomaniak.ch |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Synopsis
CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE /table_name/ (
{ /column_name/ /data_type/ [ DEFAULT /default_expr/ ] [ /column_constraint/ [, ... ] ]
| /table_constraint/ } [, ... ]
)
[ INHERITS ( /parent_table/ [, ... ] ) ]
[ WITH OIDS | WITHOUT OIDS ]
..
..
so this will mean that every column's constraint will be separated by a `,' !
but when I try to create:
sysobs=# CREATE TABLE person ( person_id SERIAL CONSTRAINT pk__person__person_id PRIMARY KEY
sysobs(# , guarantor integer CONSTRAINT fk__person__person_id REFERENCES person(person_id)
sysobs(# , firstname varchar(32) CONSTRAINT nn__person__firstname NOT NULL , CONSTRAINT u__person__firstname UNIQUE
sysobs(# , lastname varchar(32) CONSTRAINT nn__person__lastname NOT NULL
sysobs(# , email varchar(64) CONSTRAINT u__person__email UNIQUE
sysobs(# , phone varchar(32) CONSTRAINT u__person__phone UNIQUE);
ERROR: parser: parse error at or near ","
this is what I've got !
So I've I removed the `,' between the two column's constraint :
sysobs=# CREATE TABLE person ( person_id SERIAL CONSTRAINT pk__person__person_id PRIMARY KEY
sysobs(# , guarantor integer CONSTRAINT fk__person__person_id REFERENCES person(person_id)
sysobs(# , firstname varchar(32) CONSTRAINT nn__person__firstname NOT NULL CONSTRAINT u__person__firstname UNIQUE
sysobs(# , lastname varchar(32) CONSTRAINT nn__person__lastname NOT NULL
sysobs(# , email varchar(64) CONSTRAINT u__person__email UNIQUE
sysobs(# , phone varchar(32) CONSTRAINT u__person__phone UNIQUE);
..
..
CREATE
and !bam! it works !
So is my interpretation of the synopsis wrong or is'it the synopsis itself which is wrong ?
Regards
Cédric BRINER
From | Date | Subject | |
---|---|---|---|
Next Message | Sean Chittenden | 2004-05-04 07:06:51 | Re: [GENERAL] cache lookup of relation 165058647 failed |
Previous Message | BRINER Cedric | 2004-05-04 06:59:54 | pgsql documentation error ? |