Re: Rules/Trigges Trade-offs

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Ian Harding" <ianh(at)tpchd(dot)org>, <jllachan(at)nsd(dot)ca>
Cc: <pgman(at)candle(dot)pha(dot)pa(dot)us>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Rules/Trigges Trade-offs
Date: 2002-12-09 20:06:09
Message-ID: 200212091206.09064.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Berkus
Aglio Database Solutions
San Francisco

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2002-12-09 20:40:09 Re: Rules/Trigges Trade-offs
Previous Message Richard Huxton 2002-12-09 16:28:32 Re: Default Permissions (repost from Novice)