| From: | Alessandro GARDICH <gremlin(at)gremlin(dot)it> | 
|---|---|
| To: | pgsql-general(at)postgresql(dot)org | 
| Subject: | automatic update | 
| Date: | 2003-09-02 08:34:14 | 
| Message-ID: | 1062491653.3203.47.camel@motoko.loc | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Hi to all ...
I'm looking to a way to auto update some fields of a row when other
fileds are updated.
the table structure are simple,
CREATE TABLE param (
id int4 PRIMARY KEY,
val int4,
ts timestam(3) DEFAULT CURRENT_TIMESTAMP
);
so when a new entry are insert ts areautomatically update,
but i would make the same on update ...
i would that on 
UDPATE param SET val=100 WHERE id=1;
also ts field have to be updated to CURRENT_TIMESTAMP
I try with a RULE but obtain only a loop, seem RULE aren't good to make
such things, modify a statment on the same table it's related :( 
i look for a trigger but I suppose the same problem arise ...
how i can solve the problem ???
mhhh does i have to have a VIEW of parm ... called param2 without the ts
field and make a rule on param2 that update param.ts ??? 
seem a bit tricky :( ... 
thanks in advance ...
-- 
Alessandro GARDICH <gremlin(at)gremlin(dot)it>
gremlin.it
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Sephiroth | 2003-09-02 08:49:54 | Re: After install 7.3.4, I got a 7.3.3 ver. no? | 
| Previous Message | expect | 2003-09-02 06:58:44 | Re: pgadmin3 on Gentoo |