From: | "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com> |
---|---|
To: | Assad Jarrahian <jarraa(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: SELECT Rules or stored procedure |
Date: | 2006-01-19 00:17:02 |
Message-ID: | 20060119001702.GG17896@pervasive.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, Jan 17, 2006 at 09:55:42PM -0700, Assad Jarrahian wrote:
> I have a query that takes two tables (join) and does something on it.
> Lets say these tables are A and B.
> What I need is that everytime one of the tables (A) has its rows
> selected, I want to update the count (which is a column in A) for that
> row.
>
> I am not sure what is the best way to do this.
> 1)I could create a dummy view and do a RULE on that (I am not sure how
> to get access to the row's that have been selected).
> 2) I could create a storedprocedure. Get all the rows to be returned
> and then, loop through the rows and update the column and then return
> it.
>
> Q1) Which way is better?
> q2) How does one get access to the rows just selected in the CREATE
> RULE computation?
Via NEW and OLD. Read Chapter 34 of the documentation.
--
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 | Trent Shipley | 2006-01-19 00:26:32 | RAID-50 |
Previous Message | Simon Riggs | 2006-01-19 00:15:32 | Re: No heap lookups on index |