Re: Rules/Trigges Trade-offs

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Rules/Trigges Trade-offs
Дата
Msg-id 200212091206.09064.josh@agliodbs.com
обсуждение исходный текст
Ответ на Rules/Trigges Trade-offs  (Jean-Luc Lachance <jllachan@nsd.ca>)
Список pgsql-sql
Ian,

> Anyway, I have a similar requirement, to intercept insert/update/delete and
redirect the data if a condition is met.  Right now I am trying an INSTEAD
rule that puts the condtion in the WHERE of the rule definition.  It seems to
work OK, but if the condition has exeptions where I would like to throw an
error, I can't.  And since it is an INSTEAD, I can't have a trigger on the
table fire to find the exception cases.  Urgh.

I'd suggest a "DO INSTEAD SELECT some_function(NEW)"
where some_function is a function that tests for errors, throws and exception
if necessary, otherwise inserts.  It's tricky, but probably the best way to
get trigger + rule functionality at once.

--
-Josh BerkusAglio Database SolutionsSan Francisco



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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Default Permissions (repost from Novice)
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Rules/Trigges Trade-offs