Thomas Lockhart <lockhart@alumni.caltech.edu> writes:
> The grammar allows *only* PRIMARY KEY on the SERIAL column
> declaration, since the other keywords or clauses are either redundant
> or nonsensical in the context of a serial column.
Just to put another item on your todo list ;-) ...
I think it's poor practice to try to enforce such a restriction via
the grammar, because that way you cannot generate an error more
specific than "parse error near FOO". It'd be better to allow the
same ColQualifier for SERIAL as for any other column type, and then to
put sanity checks in analyze.c that would complain about conflicting
specifications. We have, or should have, most of those checks in
place already to catch conflicting ColQualifier entries for a plain
column type (eg, "foo int4 NULL NOT NULL"). Also, I do not like
generating hard errors for specifications that are merely redundant
("foo SERIAL NOT NULL"); is there any basis in the SQL spec for
refusing such constructs?
regards, tom lane