Title: field incrementing in a PL/pgSQL trigger
Hi,
My boss wants to add some logging functionality to some of our tables on update/delete/insert. I need to log who, when, table_name, field name, original value and new value for each record, but only logging modified fields, and he wants m
On Thu, Oct 28, 2004 at 09:14:17AM -0700, Tim Vadnais wrote:
>
> My questions are: Is there a way I can dynamically determine the number of
> fields in the rows that is being maintained. (a function much like:
> PQnfields(const PGresult *); )
> Then I need a way to get the name of the field (using
"Tim Vadnais" <[EMAIL PROTECTED]> writes:
> My questions are: Is there a way I can dynamically determine the number of
> fields in the rows that is being maintained.
I'm starting to think there should be a FAQ entry for this ;-)
plpgsql is essentially incapable of doing anything that involves dyn
Hi,
My boss wants to add a special type of logging to some of our tables on
update/delete/insert. I need to log who, when, table_name, field name,
original value and new value for each record, but only logging modified
fields, and he wants me to do this using postgres pgSQL triggers. The
changes
Create a different trigger function for each table, then each trigger can
be customized to know the column names.
You can generate the triggers from a little script which queries the
system tables to get at the column names. It would spit code like 'IF
NEW.fieldname != OLD.fieldname THEN (
"Tim Vadnais" <[EMAIL PROTECTED]> writes:
> My questions are: Is there a way I can dynamically determine the number of
> fields in the row that is being maintained. (a function much like:
> PQnfields(const PGresult *); )
> Then I need a way to get the name of the field (using a function much like:
Hi,
My boss wants to add some logging functionality to some of our tables on
update/delete/insert. I need to log who, when, table_name, field name,
original value and new value for each record, but only logging modified
fields, and he wants me to do this wing postgres pgSQL triggers.
We are give