Re: Please advise features in 7.1 (SUMMARY) - Mailing list pgsql-hackers

From Ross J. Reedstrom
Subject Re: Please advise features in 7.1 (SUMMARY)
Date
Msg-id 20001128094324.A14303@rice.edu
Whole thread Raw
In response to Please advise features in 7.1 (SUMMARY)  ("John Huttley" <John@mwk.co.nz>)
List pgsql-hackers
On Tue, Nov 28, 2000 at 02:04:01PM +1300, John Huttley wrote:
> Thanks for your help, everyone.
> 
> This is a summary of replies.
> 
> 1. Calculated fields in table definitions . eg.
> 
>     Create table test (
>              A Integer,
>              B integer,
>             the_sum   As  (A+B),
> );
> 
> This functionality can be achieved through the use of views.

Using a view for this isn't quite the same functionality as a computed
field, from what I understand, since the calculation will be done at
SELECT time, rather than INSERT/UPDATE.

This can also be done with a trigger, which, while more cumbersome to
write, would be capable of doing the math at modification time.

Ross
-- 
Open source code is like a natural resource, it's the result of providing
food and sunshine to programmers, and then staying out of their way.
[...] [It] is not going away because it has utility for both the developers 
and users independent of economic motivations.  Jim Flynn, Sunnyvale, Calif.


pgsql-hackers by date:

Previous
From: Zeugswetter Andreas SB
Date:
Subject: AW: Re: [GENERAL] is it a bug?
Next
From: Philip Warner
Date:
Subject: Problem in AlterTableAddConstraint?