Re: [HACKERS] Serial and NULL values

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Jan Wieck <wieck(at)debis(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Serial and NULL values
Date: 1999-10-31 13:17:32
Message-ID: 199910311317.IAA29898@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> > 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
>
> I agree with tom.
>
> If you don't want the user to be able to insert NULL, specify
> NOT NULL explicitly. And if you want to force a default
> behaviour, use a trigger (a rule can't do - sorry).

I thought Informix put the nextval with NULL, but I now see they do it
with zero, which is pretty strange.

Never mind.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Karel Zak - Zakkr 1999-10-31 14:26:51 Patch - Re: [HACKERS] view vs. inheritance hierarchy
Previous Message Bruce Momjian 1999-10-31 13:15:12 Re: [HACKERS] Serial and NULL values