dear list,
i'm trying to implement a general logging scheme with a plpgsql-trigger.
The idea is, that after an update the trigger compares the elements of
OLD and NEW and logs the changes made to the record columns. the trigger
should be usable by any table, so the field names are not known
beforehand. the natural solution seems to me to convert the records OLD,
NEW into 2-dimensional arrays where the second dimension is used to
address column-name and column_data and to step thru this array.
e.g. NEW{id=55;name='test'} would become a_new[1][1]='id;
a_new[1][2]=55; a_new[2][1]='name']; a_new[2][2] = 'test'.
as i think, that this should be quite a common problem, i would like to
ask whether some C-guru has already written a CAST-function for RECORD
to ARRAY, or has some better idea to solve this task.
thanks in advance, wz