trigger fired on changes in specific column

From: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: trigger fired on changes in specific column
Date: 2002-08-23 06:52:32
Message-ID: Pine.LNX.4.44.0208230807340.7722-100000@zigo.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I would like to fire a trigger when the value in a single column have
changed. I read somewhere that this is in the SQL-standard but not in
postgresql, I don't have the SQL-spec so I can't check, and I don't know
what version of the standard.

I can't find it in the todo list though, either it's missing and should be
added or it's not there by intention.

I have a table where the rows are partitioned into small groups. When a
value in column A changes, then every value in the same group would have
their column B value updated. This would in turn trigger more things, If
the trigger is fired only when column A changes the problem is solved.

After this I need to do almost the same procedure where a value of column
B is changed to update the column C for all rules in the group. This
ordering of triggers would work automatically if they fire just when the
correct column are updated.

Well, I can work around these things. One way is to place B and C in their
own tables so updating these don't trigger anything in the original table.
I also think I can keep them in the relation by being carefull and not
update unless the value actually changed, this costs a litle extra CPU
time.

If i'm lucky it's even fixed in 7.3 and then I can live without it for a
while.

--
/Dennis

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Davis 2002-08-23 07:41:02 Re: Mysql -> PgSQL
Previous Message Janning Vygen 2002-08-23 06:45:42 Two servers on one machine