Is there any way to get the name of the current user inside a PL/pgSQL
function that is defined with security definer?
current_user gives the name of the user who created the function.
The reason I want this is that I intend to use functions to maintain
security, like this:
userA has only select permission on myTable.
The only way userA can insert to myTable is by providing parameters
for and executing myFunction.
myFunction was created by user postgres who does have insert
permission on myTable. However the code inside myFunction needs to do
different things, depending on who called it.
Is there any way of getting the user?
regards
Richard