On Fri, 2006-11-17 at 16:42 -0800, Jeremy Smith wrote:
> On 11/17/06, Jeff Davis <[EMAIL PROTECTED]> wrote:
> >
> > Why do you need so many functions though? Won't one SQL function do the
> > trick?
> >
> > Regards,
> >         Jeff Davis
> >
> >
> 
> You're right, one will do the trick - I was thinking update and
> delete, but of course those will be fine with plain rules because they
> don't need to do anything with default values.
> 
> Even so, I guess I have to use a trigger+function instead of a real
> rule, and have an INSTEAD DO NOTHING rule for insert so that the
> trigger gets called without error.  Seems like a bit of a kludge; I
> think I may just give up and do all this stuff in application logic
> instead of database logic.
> 

For a trigger to work the columns have to match up. You'd have to create
some kind of empty table that you can insert everything you want into,
and have a BEFORE INSERT trigger to take in all the values, pass them
off to child tables, and then return NULL.

That's functionally not much different from having a rule rewrite the
insert into a function call. If you decide to implement it in the
database I think that's the cleanest way. Why do you think a rule that
makes a function call won't work?

Regards,
        Jeff Davis


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to