Re: Row locking inside a rule, is it possible?

From: Denis Chavez <dnchavez(at)gmx(dot)net>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Row locking inside a rule, is it possible?
Date: 2002-04-06 05:30:39
Message-ID: 23949.1018071039@www53.gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks.

I kept trying and discovered that if I write the rule:

CREATE RULE mnt_order_submit_upd AS ON UPDATE TO mnt_order_submit
DO INSTEAD
(SELECT * FROM mnt_order WHERE mnt_order=OLD.mnt_order FOR UPDATE OF
mnt_order;
UPDATE mnt_order SET
emission_date=NEW.emission_date,emission_user=NEW.emission_user,
mnt_area=NEW.mnt_area,assign_date=NEW.assign_date,technician=NEW.technician
WHERE mnt_order=OLD.mnt_order);

It works fine. My advice: when selecting for update inside a rule, we must
especify the table twice?, that is: SELECT * FROM tablename WHERE ... FOR
UPDATE OF tablename; :-)

Regards,
Denis

> Denis Chavez <dnchavez(at)gmx(dot)net> writes:
> > I get the followin error:
> > Internal Error: no jointree entry for rel *NEW* (3)
>
> Could we see a complete example that causes this? I'm too pressed for
> time to try to reverse-engineer your table declarations.
>
> regards, tom lane
>

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-04-06 06:26:07 Re: Row locking inside a rule, is it possible?
Previous Message Tom Lane 2002-04-06 02:41:24 Re: 7.1.2 clients + 7.2.1 server?