Computed columns and functions? - Mailing list pgsql-novice

From David Benoff
Subject Computed columns and functions?
Date
Msg-id 000b01c38698$ebd71c00$ba00a8c0@david
Whole thread Raw
Responses Re: Computed columns and functions?
Re: Computed columns and functions?
List 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

pgsql-novice by date:

Previous
From: Oliver Fromme
Date:
Subject: Re: Foreign keys and null
Next
From: Tom Lane
Date:
Subject: Re: Foreign keys and null