How can I update on select?

>From the User's Guide, it seems triggers can only be used on INSERT,
UPDATE and DELTE events. As for rules, the guide says they can be used on
SELECT. When I actually tried updating on select using rules, here's what
I got:

test=> CREATE RULE tab_rule AS ON select
test-> TO tab
test-> DO UPDATE tab SET stats=stats+1; 
ERROR:  only instead-select rules currently supported on select

My ultimate goal is to keep statistics for tab counting how many times
records are being selected. Unfortunately, I cannot simply use UPDATE
since my SELECT queries use LIMIT, which is not supported by UPDATE.

Looking forward to any suggestions,
Marc


************

Reply via email to