Tutorial :What's the PostgreSQL equivalent of MSSQL's CONTEXT_INFO?


In relation to my other question "What’s the best way to audit log DELETEs?". What's the PostgreSQL equivalent of CONTEXT_INFO?


I want to log deletes using trigger, but since i'm not using the database user as my app's logical user, I cannot log the CURRENT_USER from the trigger code as the user who deleted the record. But for INSERT and UPDATE it is possible to log the record changes from trigger since you can just add a user field in the record, say inserted_by and last_updated_by, and use these fields to log to audit table.



PostgreSQL provides more variants, please, look to this site.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »