create synopsis wrong ?

Started by BRINER Cedricalmost 22 years ago1 messagesgeneral
Jump to latest
#1BRINER Cedric
work@infomaniak.ch

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