User Functions
Several of the included functions in PostgreSQL deal with user and session issues. The following sections discuss user-related functions.
CURRENT_USER
Description
The CURRENT_USER function returns the user ID being used for permission checking.
Inputs
None.
Example
SELECT CURRENT_USER;
--------------
webuser
Notes
Currently, CURRENT_USER and SESSION_USER are the same, but in the future, there might be a distinction as needed for programs running in a setuid mode.
Notice that the preceding function is not called with the trailing parentheses "()". This is to maintain SQL compatibility.
SESSION_USER
Description
The SESSION_USER function returns the user ID that is currently logged into PostgreSQL.
Inputs
None.
Example
SELECT SESSION_USER;
--------------
webuser
Notes
Currently, CURRENT_USER and SESSION_USER are the same, but in the future, there might be a distinction as needed for programs running in a setuid mode.
Notice that the preceding function is not called with the trailing parenthesis "()". This is to maintain SQL compatibility.
USER
Notes
See CURRENT_USER.
|