Search Postgresql Archives

Is this possible in a trigger?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to keep a history of changes on a field in a table.  This will be the case in multiple tables.

Can I create a trigger that loops the OLD and NEW values and compares the values and if they are different creates a change string as follows:

e.g;

FOR EACH field IN NEW
    IF field.value <> OLD.field.name THEN
       changes := changes
            || field.name
            || ' was: '
            || OLD.field.value
            || ' now is: '
            || field.value
            || '\n\r';
    END IF
END FOR;


Your help is really appreciated.

Thank you.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux