From: | "Luis Silva" <lfs12(at)hotmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Trigger problem |
Date: | 2006-03-20 10:23:51 |
Message-ID: | BAY115-F312462E926FB4F8055257AB5DB0@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi there, I'm having a problem, When I'm doing an update to one of the
fields of my table I need to know if it's changed.
For exemple I have the table with the columns
id,identity,registration_state.
Test:
id | identity | registration_state
1 | Joe | registered
2 | Tom | not_registered
3 | James | unregistered
when i do "update test set registration_state='registered'" I need to know
for which identities the registration_state was change (and then return it).
In this case, Tom and James.
I was thinking about using a trigger function for the updates, using
pl/pgsql (using before in the trigger). the problem is that I don't know how
to get the old registration_state when I have multiple rows affected. I
known that if I use OLD.registration_state it works for one rows. Can you
help for multiple? tks a lot in advance
From | Date | Subject | |
---|---|---|---|
Next Message | Terry Lee Tucker | 2006-03-20 10:35:18 | Re: Trigger problem |
Previous Message | Andreas Kretschmer | 2006-03-19 11:51:13 | Re: Return count between timestamps |