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

Поиск
Список
Период
Сортировка
От Denis Chavez
Тема Re: Row locking inside a rule, is it possible?
Дата
Msg-id 23949.1018071039@www53.gmx.net
обсуждение исходный текст
Ответ на Row locking inside a rule, is it possible?  (Denis Chavez <dnchavez@gmx.net>)
Ответы Re: Row locking inside a rule, is it possible?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@gmx.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


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: 7.1.2 clients + 7.2.1 server?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Row locking inside a rule, is it possible?