On Fri, Oct 29, 1999 at 08:20:30PM -0400, Bruce Momjian wrote:
> >
> > Offhand I don't see any fundamental reason why serial columns should
> > be restricted to be nonnull, but evidently someone did at some point.
>
> The actual null is not the issue. The issue is that if we have a
> SERIAL column, and we try to put a NULL in there, shouldn't it put the
> default sequence number in there?
>
It seems logical that if a value was supplied for a serial column that
it would override the default. After all, SERIAL is just an int column
with a default based on a sequence, right?. If the default is always
used (even when a value is supplied) then that would be a REAL BIG problem.
Without making SERIAL a distinctly different datatype, I can't see how
a default sequence could behave differently for two tables created with
different syntax.
My 2 cents is that the current behavior is the correct behavior.
As far as the NULL goes, since the SERIAL column is assumed to be a
key and a unique index is created, having it NOT NULL seems like a
good idea. I don't know anyone who would have a key value be NULL,
and even if it could be NULL, you would olny be allowd one NULL.
--
The world's most ambitious and comprehensive PC game database project.
http://www.mobygames.com