Skip site navigation (1) Skip section navigation (2)

Re: Column default

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: KeithW(at)narrowpathinc(dot)com,PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Column default
Date: 2005-02-15 14:54:46
Message-ID: 20050215145446.87208.qmail@web20827.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-novice
--- Keith Worthington <keithw(at)narrowpathinc(dot)com>
wrote:

>Why aren't the defaults applied when data arrives
>that is an update?  

The updated row will consist of all of the previous
column values, except for those which your update
statement has explicitly changed.

>What is
>the elegant way to ensure that if records are
>updated with missing 
>information
>the defaults are applied?

With a trigger.  Since you are doing your processing
via a trigger anyway, you could just put your data
validation logic right there in the function.

>
>Why aren't the defaults applied when data arrives
>that is an insert?  

They are.  Your last message did not show any evidence
that that was not happening.

>What is
>the elegant way to ensure that if records are
>inserted with missing
>information the defaults are applied?

As above.




		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 

In response to

pgsql-novice by date

Next:From: operationsengineer1Date: 2005-02-15 15:14:04
Subject: Revision Control
Previous:From: Mike G.Date: 2005-02-15 03:38:53
Subject: Re: Question on PL/Perl

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group