Re: [GENERAL] Access NEW and OLD from function called by a rule

2005-08-13 Thread Frodo Larik
Frodo Larik wrote: That means I have to create functions like insert_person(workers) , insert_person(othertable) and function insert_person(anothertable). I found the solution to this "problem". Create a function with a Polymorphic Type (notice the anyelement): CREATE OR REPLACE FUNCTION i

Re: [GENERAL] Access NEW and OLD from function called by a rule

2005-08-12 Thread Frodo Larik
Hi Tom, Tom Lane wrote: Frodo Larik <[EMAIL PROTECTED]> writes: PostgreSQL obviously complains about NEW not available, how can I make it available? Is this the way to do it? No. You seem to have read something about trigger functions, but this usage is not a trigger function. You

Re: [GENERAL] Access NEW and OLD from function called by a rule

2005-08-12 Thread Tom Lane
Frodo Larik <[EMAIL PROTECTED]> writes: > PostgreSQL obviously complains about NEW not available, how can I make > it available? Is this the way to do it? No. You seem to have read something about trigger functions, but this usage is not a trigger function. You need to do it more like this: re

[GENERAL] Access NEW and OLD from function called by a rule

2005-08-12 Thread Frodo Larik
Hello, I was wondering if it was possible to get a hold of the NEW and OLD variables available in a Rule and pass them to a function? Maybe there is another (better) way of accomplishing what I try to do, so I'll sketch you my testing layout: CREATE TABLE clients ( id SERIAL PRIMARY KEY,