pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Julian Scarfe <julian@avbrief.com>
To: Markus Schaber <schabi@logix-tt.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: NULL becomes default
Date: Sun, 20 Aug 2006 11:34:48 +0100
Message-ID: <0cb101c6c444$44867300$0600a8c0@Wilbur> (raw)
References: <029c01c6c228$8e8e5210$0600a8c0@Wilbur>
	<44E6C30D.1070608@logix-tt.com>

>> 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@logix-tt.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 





view thread (5+ messages)  latest in thread

Message-ID: <0cb101c6c444$44867300$0600a8c0@Wilbur>
Permalink:  ../0cb101c6c444$44867300$0600a8c0@Wilbur/
Also on:    postgresql.org/message-id/0cb101c6c444$44867300$0600a8c0@Wilbur

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: julian@avbrief.com, schabi@logix-tt.com
  Subject: Re: NULL becomes default
  In-Reply-To: <0cb101c6c444$44867300$0600a8c0@Wilbur>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox