From: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com> |
---|---|
To: | Michelle Konzack <linux4michelle(at)freenet(dot)de> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: create summaries and update a second table? |
Date: | 2006-01-06 00:29:04 |
Message-ID: | 20060106002904.GH43311@pervasive.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jan 04, 2006 at 07:49:30PM +0100, Michelle Konzack wrote:
> Hello *,
>
> I have many tables (one per product) and the are two columns where I
> put my buyed and selled pieces. Second I have a Main-Table with all
> products and a summary of the stock.
>
> What I want is, whenever I buy or sell something, the changements
> (buy/sell) in the product table must triger an update in the Main-
> Table.
See the end of
http://www.postgresql.org/docs/8.1/interactive/plpgsql-trigger.html.
Though one issue with that is there's a race condition in the
update/insert block. Ironically I just submitted a patch today to fix
that (see -patches archive), but in a nutshell you want to use the code
from example 34-1.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2006-01-06 00:48:37 | Re: NEW variable values in trigger functions |
Previous Message | Jim C. Nasby | 2006-01-06 00:23:05 | Re: Moving Tablespaces |