Search Postgresql Archives

create synopsis wrong ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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





---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux