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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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