Does anyone know how to write a trigger that would identify which columns
have actually changed in an update (and then log them to an archive).
I suspect that the function would look something like;
CREATE FUNCTION FIND_CHANGED_COLUMNS() RETURNS OPAQUE AS '
-- FOR EACH COLUMN IN THE RECORD:
-- IF ( NEW COLUMNx <> OLD COLUMNx)
-- LOG THE RECORD PRIMARY KEY, COLUMN NAME, OLD VALUE
' LANGUAGE 'plpgsql';
In other words
- How might you parse, in general, old and new records to compare like
- How can you find out the primary key of a record?
pgsql-sql by date
|Next:||From: denis||Date: 2004-01-16 04:32:09|
|Subject: Initially Deffered - FK|
|Previous:||From: Chris Bowlby||Date: 2004-01-15 19:06:01|
|Subject: Re: Problem with plpgsql function|