rule or trigger on select?

From: admin <admin(at)wtbwts(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: rule or trigger on select?
Date: 2000-01-12 17:42:47
Message-ID: Pine.BSF.4.10.10001121730230.68777-100000@server.b0x.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Browse pgsql-general by date

  From Date Subject
Next Message Mike Mascari 2000-01-12 17:46:33 Re: [GENERAL] Simulating an outer join
Previous Message Jim Mercer 2000-01-12 16:55:03 Re: [GENERAL] identifying performance hits: how to ???