pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Ian Harding <ianh@tpchd.org>
To: jllachan@nsd.ca
Cc: pgman@candle.pha.pa.us
Cc: pgsql-sql@postgresql.org
Subject: Re: Rules/Trigges Trade-offs
Date: Mon, 9 Dec 2002 12:06:09 -0800
Message-ID: <200212091206.09064.josh@agliodbs.com> (raw)
In-Reply-To: <sdf48470.033@mail.tpchd.org>
References: <sdf48470.033@mail.tpchd.org>


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




view thread (14+ messages)  latest in thread

Message-ID: <200212091206.09064.josh@agliodbs.com>
Permalink:  ../200212091206.09064.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200212091206.09064.josh@agliodbs.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: josh@agliodbs.com, ianh@tpchd.org, jllachan@nsd.ca, pgman@candle.pha.pa.us
  Subject: Re: Rules/Trigges Trade-offs
  In-Reply-To: <200212091206.09064.josh@agliodbs.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox