Re: [HACKERS] Serial and NULL values
От | Brian Hirt |
---|---|
Тема | Re: [HACKERS] Serial and NULL values |
Дата | |
Msg-id | 19991029212642.A24778@loopy.berkhirt.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] Serial and NULL values (Bruce Momjian <maillist@candle.pha.pa.us>) |
Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: