Re: [HACKERS] Primary key requires SERIAL - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Primary key requires SERIAL
Date
Msg-id 1502.942994083@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Primary key requires SERIAL  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: [HACKERS] 7.0 status request
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] 7.0 status request