postgresql_16:9.6.41.3 insert_username — Functions for Tracking Who Changed a Table
PostgreSQL 16 > Appendixes > Additional Supplied Modules and Extensions > spi — Server Programming Interface features/examples > insert_username — Functions for Tracking Who Changed a Table
insert_username() is a trigger that stores the current user's name into a text field. This can be useful for tracking who last modified a particular row within a table.
To use, create a BEFORE INSERT and/or UPDATE trigger using this function. Specify a single trigger argument: the name of the text column to be modified.
There is an example in insert_username.example.