From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "omid omoomi" <oomoomi(at)hotmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Table rule does not work! |
Date: | 2001-03-03 00:34:15 |
Message-ID: | 5084.983579655@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"omid omoomi" <oomoomi(at)hotmail(dot)com> writes:
> when I insert into table tk ,I expect to have table tu updated... but it is
> not! although there is no error message with it, the table tu remains
> unchanged.
I cannot duplicate a problem with that rule, using either 7.0.2 or
current sources:
play=> create table tk(k1 int, k2 int, k3 int, k4 int, k5 int);
CREATE
play=> create table tu(u1 int, u2 int, u3 int);
CREATE
play=> insert into tu values (1,1,1);
INSERT 745816 1
play=> insert into tu values (2,2,2);
INSERT 745817 1
play=> create rule tk_rule1 as on insert to tk do
play-> update tu
play-> set u1 = u1 + (new.k2 - new.k1) ,
play-> u2 = u2 + (new.k3 + new.k4 )
play-> where tu.u3 = new.k5 ;
CREATE 745818 1
play=> insert into tk values (7,22,42,17,2);
INSERT 745819 1
play=> select * from tk;
k1 | k2 | k3 | k4 | k5
----+----+----+----+----
7 | 22 | 42 | 17 | 2
(1 row)
play=> select * from tu;
u1 | u2 | u3
----+----+----
1 | 1 | 1
17 | 61 | 2
(2 rows)
play=>
Either you made a mistake, or there's some other factor you haven't
mentioned.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Lincoln Yeoh | 2001-03-03 04:15:06 | Re: Re: serial properties |
Previous Message | Dan Harrington | 2001-03-02 23:12:24 | Error message on pg_dumpall |