Row locking inside a rule, is it possible?

From: Denis Chavez <dnchavez(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Row locking inside a rule, is it possible?
Date: 2002-04-05 23:04:33
Message-ID: 17979.1018047873@www59.gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I've got the followin problem: I have a view for which I want to create a
rule for update, but in the rule I want to lock the updating row -i don't know
if this is possible-, anyway I created the rule and had no problem:

CREATE RULE mnt_order_submit_upd AS ON UPDATE TO mnt_order_submit
DO INSTEAD
[SELECT emission_date,emission_user,mnt_area,assign_date,technician
FROM mnt_order WHERE mnt_order=OLD.mnt_order FOR UPDATE;
UPDATE mnt_order SET emission_date=NEW.emission_date,
emission_user=NEW.emission_user,mnt_area=NEW.mnt_area,
assign_date=NEW.assing_date technician=NEW.technician
WHERE mnt_order=OLD.mnt_order];

But when I try to update:

UPDATE mnt_order_submit SET emission_date='2002-04-04',emission_user='1',
mnt_area='2',assign_date='2002-04-04',technician='4' WHERE
mnt_order='15';

I get the followin error:

Internal Error: no jointree entry for rel *NEW* (3)

Any idea of what i'm doing wrong or a better solution to the problem?
I use Debian, Postgres 7.1 and I wrote the rule and the update from pgsql
from an account with all privileges.

Regards and thank you for your comments.
Denis.

--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sam Tregar 2002-04-05 23:37:03 ANNOUNCE: Bricolage 1.3.1
Previous Message Stephan Szabo 2002-04-05 22:34:50 Re: