Re: one more word about rules

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Papp Gyozo <s7461pap(at)hszk(dot)bme(dot)hu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: one more word about rules
Date: 2000-09-22 14:45:54
Message-ID: 26602.969633954@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Papp Gyozo <s7461pap(at)hszk(dot)bme(dot)hu> writes:
> In pgsql 7.0.2, there is no way to create a rule which can perform an
> additional query after SELECT. What I'm writing about:
> CREATE RULE r_my_dream AS ON SELECT TO xxx
> DO UPDATE xxx SET c_lastref = current_timestamp, c_refnum = c_refnum + 1
> WHERE xxx.oid = old.oid;

I don't think this is a real good idea. If it were enforced by the
database then you couldn't (just to take one example) produce a backup
dump without clobbering all your lastref information. And what of
queries like SELECT count(*) FROM table --- should that update the
timestamps of all the rows it reads, and if not why not?

I think you'll have to consider "access" (ie, an action that triggers
a lastref update) to be an application-defined concept, and that means
implementing the updates on the application side.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Denis Perchine 2000-09-22 14:46:22 Re: Re: Large Objects
Previous Message Abe Asghar 2000-09-22 14:33:46 Re: one more word about rules