Trigger problem

Поиск
Список
Период
Сортировка
От Luis Silva
Тема Trigger problem
Дата
Msg-id BAY115-F312462E926FB4F8055257AB5DB0@phx.gbl
обсуждение исходный текст
Ответ на Re: check problem  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: Trigger problem
Список 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 по дате отправления:

Предыдущее
От: Andreas Kretschmer
Дата:
Сообщение: Re: Return count between timestamps
Следующее
От: Terry Lee Tucker
Дата:
Сообщение: Re: Trigger problem