From: | fabrizio(dot)ermini(at)sysdat(dot)it |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | need hint for a trigger... |
Date: | 2001-03-16 10:05:55 |
Message-ID: | 3AB1F393.28994.76206F@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all. I have to write a trigger and I have never did it before, so if
there is someone who could give me a start, I will be very grateful...
I have two tables that I want to keep "partially" synced, i.e.:
table1 (field1,field2,field3)
table2 (field1,field2,field3, ... some other fields).
I've created them using the same data for the common fields, and
then populated the other fields of table2. field1 is unique key for
both tables.
I would like that when a record gets changed in table1, the same
changes reflect on the correspondent record in table2. Eventual
changes made on the first 3 fields of table2 should be overwritten,
leaving the other fields untouched.
I was presuming this could be done with a trigger on UPDATE on
table1, but I don't know how to write it... I know the first reply that I
can expect is RTFM, but if a gentle soul has the time to write an
example...
TIA,
Ciao
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Fabrizio Ermini Alternate E-mail:
C.so Umberto, 7 faermini(at)tin(dot)it
loc. Meleto Valdarno Mail on GSM: (keep it short!)
52020 Cavriglia (AR) faermini(at)sms(dot)tin(dot)it
From | Date | Subject | |
---|---|---|---|
Next Message | Anand Raman | 2001-03-16 11:13:43 | pg_dump not working.. |
Previous Message | Piotr Kasprzyk | 2001-03-16 09:41:52 | No response from backend |