Re: Question about NOT NULL and default values. - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Question about NOT NULL and default values.
Date
Msg-id dcc563d10810162112i1fb1661bp3cef4b81fb17f6bf@mail.gmail.com
Whole thread Raw
In response to Re: Question about NOT NULL and default values.  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Responses Re: Question about NOT NULL and default values.  (brian <brian@zijn-digital.com>)
List pgsql-general
On Thu, Oct 16, 2008 at 10:06 PM, Stephan Szabo
<sszabo@megazone.bigpanda.com> wrote:
>
> On Thu, 16 Oct 2008, Scott Marlowe wrote:
>
>> On Thu, Oct 16, 2008 at 10:01 PM, Stephan Szabo
>> <sszabo@megazone.bigpanda.com> wrote:
>> > On Fri, 17 Oct 2008, Tim Uckun wrote:
>> >
>> >> Is there a way to change this behavior so that an attempt to set the
>> >> column to NULL will result in the default value being put in the
>> >> field?
>> >
>> > I don't think so specifically with default, but you could use a before
>> > trigger instead that would put in a value in the new row if NULL was
>> > given.
>>
>> I'm pretty sure that will fail as the primary key or not null
>> constraint comes first.
>
> Well, since he said that he'd removed the not null constraint in his
> testing, I figured that was a viable option.

Yeah, then it might.   But I get the feeling the OP just wasn't
assigning a sequence as a defult.

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: Question about NOT NULL and default values.
Next
From: Magnus Hagander
Date:
Subject: Re: postgresql on 64-bit windows