Row locking inside a rule, is it possible? - Mailing list pgsql-general

From Denis Chavez
Subject Row locking inside a rule, is it possible?
Date
Msg-id 17979.1018047873@www59.gmx.net
Whole thread Raw
Responses Re: Row locking inside a rule, is it possible?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re:
Next
From: Sam Tregar
Date:
Subject: ANNOUNCE: Bricolage 1.3.1