Computed columns and functions?

From: "David Benoff" <dbenoff(at)covad(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Computed columns and functions?
Date: 2003-09-29 14:49:44
Message-ID: 000b01c38698$ebd71c00$ba00a8c0@david
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi all,
I’d like to set up a computed column that uses a function to derive its
data, but can’t seem to find any information on how to do this. My
issue, specifically, is this:

I have a user table and an account activity table, which contains
records of debits and credits to an account, user id as FK. I’d like to
create a computed column within my user table to show the user’s current
balance (sum of credits minus sum of debits). I’ve written a sql query
to compute this when passed in a user id as an argument, but I can’t
figure out how to create the computed column.

Any tips would be much appreciated.

Thanks,
David Benoff

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com)
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/2003

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-09-29 15:46:25 Re: Foreign keys and null
Previous Message Oliver Fromme 2003-09-29 12:44:03 Re: Foreign keys and null