Re: Column default - Mailing list pgsql-novice

From Jeff Eckermann
Subject Re: Column default
Date
Msg-id 20050215145446.87208.qmail@web20827.mail.yahoo.com
Whole thread Raw
In response to Re: Column default  ("Keith Worthington" <keithw@narrowpathinc.com>)
List pgsql-novice
--- Keith Worthington <keithw@narrowpathinc.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

pgsql-novice by date:

Previous
From: "Mike G."
Date:
Subject: Re: Question on PL/Perl
Next
From:
Date:
Subject: Revision Control