Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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
If i'm lucky it's even fixed in 7.3 and then I can live without it for a



pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group