pgsql documentation error ?

Started by BRINER Cedricalmost 22 years ago3 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 means that every column's constrain should be separated by a comma.

but when I create the table:
CREATE TABLE person ( person_id SERIAL CONSTRAINT pk__person__person_id PRIMARY KEY
, guarantor integer CONSTRAINT fk__person__person_id REFERENCES person(person_id)
, firstname varchar(32) CONSTRAINT nn__person__firstname NOT NULL , CONSTRAINT u__person__firstname UNIQUE
, lastname varchar(32) CONSTRAINT nn__person__lastname NOT NULL
, email varchar(64) CONSTRAINT u__person__email UNIQUE
, phone varchar(32) CONSTRAINT u__person__phone UNIQUE);
I get: ERROR: parser: parse error at or near ","

and when I replace in the firstname definition the `,' between the two constraint by a ` ' : it works !
CREATE TABLE person ( person_id SERIAL CONSTRAINT pk__person__person_id PRIMARY KEY
, guarantor integer CONSTRAINT fk__person__person_id REFERENCES person(person_id)
, firstname varchar(32) CONSTRAINT nn__person__firstname NOT NULL CONSTRAINT u__person__firstname UNIQUE
, lastname varchar(32) CONSTRAINT nn__person__lastname NOT NULL
, email varchar(64) CONSTRAINT u__person__email UNIQUE
, phone varchar(32) CONSTRAINT u__person__phone UNIQUE);

Am'I interpreting wrongly the documentation or ... am'I right : )

Regards

Cedric BRINER

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: BRINER Cedric (#1)
Re: pgsql documentation error ?

BRINER Cedric <work@infomaniak.ch> writes:

{ /column_name/ /data_type/ [ DEFAULT /default_expr/ ] [ /column_constraint/ [, ... ] ]

so this means that every column's constrain should be separated by a comma.

This typo is corrected in the 7.4 docs.

regards, tom lane

#3Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: BRINER Cedric (#1)
Re: pgsql documentation error ?

On Tue, 4 May 2004, BRINER Cedric wrote:

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 ]

What version are you doing this on? 7.4 seems to not have a comma there.