Re: [GENERAL] Order of Rules

2001-02-01 Thread Michael Dunn
I wrote a plpgsql function/stored procedure to get around this problem. I am not sure specifically what information you need about the row after INSERT, but you could write a function that performs the INSERTs and summing. After the initial INSERT you can use a SELECT INTO statement to pass

Re: [GENERAL] Order of Rules

2001-02-01 Thread Bruce Momjian
We know we need to change INSERT rules to fire after the command. Hopefully this will be done in 7.2. > I read at the docs that rules are executed before the query that > generated them. Is there any way to change this? > > Here's my problem: I have two tables, A and B, and after an INSERT on >

Re: [GENERAL] Order of Rules

2001-01-30 Thread Michael Fork
Here are some good references on using triggers: http://www.postgresql.org/docs/aw_pgsql_book/node204.html http://www.postgresql.org/users-lounge/docs/7.0/user/c40874113.htm These docs show you how to create a trigger, and use the information contained in the new tuple for calculations Mich

Re: [GENERAL] Order of Rules

2001-01-30 Thread Nelio Alves Pereira Filho
Yes, but how can I pass a reference of the row just inserted to the trigger?? adb wrote: > > Sounds like you need to use a trigger set to > fire after the insert on table A > > Alex. > > On Tue, 30 Jan 2001, Nelio Alves Pereira Filho wrote: > > > I read at the docs that rules are executed bef

Re: [GENERAL] Order of Rules

2001-01-30 Thread adb
Sounds like you need to use a trigger set to fire after the insert on table A Alex. On Tue, 30 Jan 2001, Nelio Alves Pereira Filho wrote: > I read at the docs that rules are executed before the query that > generated them. Is there any way to change this? > > Here's my problem: I have two tabl

[GENERAL] Order of Rules

2001-01-30 Thread Nelio Alves Pereira Filho
I read at the docs that rules are executed before the query that generated them. Is there any way to change this? Here's my problem: I have two tables, A and B, and after an INSERT on table A, I want to update an specific field on table B, with the result of a sum in A. To do this I needed some i