Re: Question about NOT NULL and default values.

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: "Tim Uckun" <timuckun(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Question about NOT NULL and default values.
Date: 2008-10-17 04:05:05
Message-ID: dcc563d10810162105m5e44b72fke9fcde4d96dc6288@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Oct 16, 2008 at 10:01 PM, Stephan Szabo
<sszabo(at)megazone(dot)bigpanda(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2008-10-17 04:06:11 Re: Question about NOT NULL and default values.
Previous Message Scott Marlowe 2008-10-17 04:04:17 Re: Question about NOT NULL and default values.