Re: Please advise features in 7.1 (SUMMARY)

From: "Ross J(dot) Reedstrom" <reedstrm(at)rice(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Please advise features in 7.1 (SUMMARY)
Date: 2000-11-28 15:43:24
Message-ID: 20001128094324.A14303@rice.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2000-11-28 15:49:11 Problem in AlterTableAddConstraint?
Previous Message Zeugswetter Andreas SB 2000-11-28 15:30:49 AW: [HACKERS] Re: is it a bug?