Trigger problem - Mailing list pgsql-novice

From Luis Silva
Subject Trigger problem
Date
Msg-id BAY115-F312462E926FB4F8055257AB5DB0@phx.gbl
Whole thread Raw
In response to Re: check problem  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: Trigger problem
List 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



pgsql-novice by date:

Previous
From: Andreas Kretschmer
Date:
Subject: Re: Return count between timestamps
Next
From: Terry Lee Tucker
Date:
Subject: Re: Trigger problem