Re: NULL becomes default

From: "Julian Scarfe" <julian(at)avbrief(dot)com>
To: "Markus Schaber" <schabi(at)logix-tt(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: NULL becomes default
Date: 2006-08-20 10:34:48
Message-ID: 0cb101c6c444$44867300$0600a8c0@Wilbur
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>> Thus I would like NULLs in such INSERTs to be treated as DEFAULT rather
>> than violating the constraint. Is there an easy way to do that at the
>> database level?

From: "Markus Schaber" <schabi(at)logix-tt(dot)com>

> Did you try a "before insert" trigger that checks new_id for null
> values, and replaces it with nextval()?

So thinking about this a little more, it requires me to be able to change a
column value to DEFAULT (unless I implement the default from scratch in the
trigger, but that feels messy). I don't have much experience of triggers:
can I do that?

Thanks

Julian

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2006-08-21 10:27:17 Re: NULL becomes default
Previous Message Markus Schaber 2006-08-19 07:51:41 Re: NULL becomes default