Rules WHERE condition

Поиск
Список
Период
Сортировка
От Robert Fitzpatrick
Тема Rules WHERE condition
Дата
Msg-id 1100708441.29305.7.camel@columbus.webtent.org
обсуждение исходный текст
Ответы Re: Rules WHERE condition
Список pgsql-general
I have a view that used union all to merge three tables together. I was
hoping to create a rule, one for each table using the WHERE condition of
the rule to determine which table gets updated. Is this possible?

This is what I have, assume the view here is a merge of three tables
using union all:

CREATE RULE "update_xrf" AS ON UPDATE TO "public"."viewdeterioratedlbp"
WHERE ((new.note)::text = 'Unit'::text)
DO INSTEAD (UPDATE tblxrf SET deterioration = new.deterioration;);

The note column contains a value that can trigger which table needs to
be updated. I would like to make one of these rules for each table to
update. But when I run the update, it says I have to have an
unconditional rule, is that right? Any suggestions?

ohc=# update viewdeterioratedlbp set note = 'Unit', deterioration =
'test' where xrf_id = 733;
ERROR:  cannot update a view
HINT:  You need an unconditional ON UPDATE DO INSTEAD rule.

Thanks,
--
Robert


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

Предыдущее
От: Dawid Kuroczko
Дата:
Сообщение: Tsearch2 and Unicode?
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: TSearch2: Problems with compound words and stop words