Re: [HACKERS] Serial and NULL values
От | Tom Lane |
---|---|
Тема | Re: [HACKERS] Serial and NULL values |
Дата | |
Msg-id | 5277.941250520@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [HACKERS] Serial and NULL values (Bruce Momjian <maillist@candle.pha.pa.us>) |
Ответы |
Re: [HACKERS] Serial and NULL values
Re: [HACKERS] Serial and NULL values |
Список | pgsql-hackers |
Bruce Momjian <maillist@candle.pha.pa.us> writes: >> 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? No, I wouldn't expect that at all. A default is inserted when you don't supply anything at all for the column. Inserting an explicit NULL means you want a NULL, and barring a NOT NULL constraint on the column, that's what the system ought to insert. I can see no possible justification for creating a type-specific exception to that behavior. If the original asker really wants to substitute something else for an explicit null insertion, he could do it with a rule or a trigger. But I don't think SERIAL ought to act that way all by itself. regards, tom lane
В списке pgsql-hackers по дате отправления: