Re: [GENERAL] SQL Rule

2006-04-27 Thread Kenneth Downs
Bert wrote: This rule is creating first of all the insert and then i can run an Update on this insert, so far its functioning. Your definition is quite good but what are doing when you change the table definition? Rewrite all Rules? I actually use a data dictionary processor that automaticall

Re: [GENERAL] SQL Rule

2006-04-26 Thread Bert
Okay sorry i have to change the trigger from AFTER TO BEFORE CREATE TRIGGER trigger_sum BEFORE INSERT OR UPDATE ON test FOR EACH ROW EXECUTE PROCEDURE trigger_test(); TO ALBAN Our table definition are the same, so what? A primary key is a constraint. And >> CREATE O

Re: [GENERAL] SQL Rule

2006-04-26 Thread Alan Hodgson
On April 26, 2006 02:35 pm, "Bert" <[EMAIL PROTECTED]> wrote: > CREATE TRIGGER trigger_sum > AFTER INSERT OR UPDATE > ON test > FOR EACH ROW > EXECUTE PROCEDURE trigger_test(); > > The inserting and updating is doing well, but its not summing up the a > and b and save it to

Re: [GENERAL] SQL Rule

2006-04-26 Thread Bert
Hi Kenneth Thats exactly what i want, because we are running more selects than inserts, and therefore a view is not the best way to go. But I still have a problem, I was doing like you told me. I have still the same table (without the rules definition) So I created a trigger function: CREATE FUNCT

Re: [GENERAL] SQL Rule

2006-04-26 Thread Alban Hertroys
Bert wrote: Hi list I have a table construction like the one seen below, when i am updating or inserting i get a recurion, logical. But how to manage it that the rule is just doing it one time. Or is it possible to do the sum of a and b in an other way? CREATE TABLE test ( a int2, b int2,

Re: [GENERAL] SQL Rule

2006-04-25 Thread Kenneth Downs
Bert wrote: Hi list I have a table construction like the one seen below, when i am updating or inserting i get a recurion, logical. But how to manage it that the rule is just doing it one time. Or is it possible to do the sum of a and b in an other way? Bert, i do this with triggers. There

Re: [GENERAL] SQL Rule

2006-04-25 Thread Wayne Conrad
On Tue, Apr 25, 2006 at 02:27:23PM -0700, Bert wrote: > I have a table construction like the one seen below, when i am updating > or inserting i get a recurion, logical. But how to manage it that the > rule is just doing it one time. Or is it possible to do the sum of a > and b in an other way? > .

Re: [GENERAL] SQL Rule

2006-04-25 Thread Oisin Glynn
Could you create the table without the C column then create a view test_view with select a,b,a+b as c,id from test; Oisin Bert wrote: Hi list I have a table construction like the one seen below, when i am updating or inserting i get a recurion, logical. But how to manage it that the rule is j

[GENERAL] SQL Rule

2006-04-25 Thread Bert
Hi list I have a table construction like the one seen below, when i am updating or inserting i get a recurion, logical. But how to manage it that the rule is just doing it one time. Or is it possible to do the sum of a and b in an other way? CREATE TABLE test ( a int2, b int2, c int2, id