Re: [HACKERS] Primary key requires SERIAL

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Primary key requires SERIAL
Дата
Msg-id 1502.942994083@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Primary key requires SERIAL  (Thomas Lockhart <lockhart@alumni.caltech.edu>)
Список 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 по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: [HACKERS] 7.0 status request
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] 7.0 status request