SELECT Rules or stored procedure

From: Assad Jarrahian <jarraa(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: SELECT Rules or stored procedure
Date: 2006-01-18 04:55:42
Message-ID: 4bd3e1480601172055i5355cd41qa28bd3af10787387@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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?

thanks.
-assad

Responses

Browse pgsql-general by date

  From Date Subject
Next Message kishore.sainath 2006-01-18 05:17:41 Re: A tale of two similar databases
Previous Message Michael Fuhr 2006-01-18 04:09:19 Re: prepared statement results don't clear?