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

江枫思渺然 提交于 2019-12-29 08:55:34

问题


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

[EDIT]

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.


回答1:


http://www.postgres.cz/index.php/PostgreSQL_SQL_Tricks_II#Any_other_session_variables

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



来源:https://stackoverflow.com/questions/696200/whats-the-postgresql-equivalent-of-mssqls-context-info

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!