Table 4-21. Miscellaneous Functions
Name | Return Type | Description |
---|---|---|
current_user | name | user name of current execution context |
session_user | name | session user name |
user | name | equivalent to current_user |
The session_user is the user that initiated a database connection and is fixed for the duration of that connection. The current_user is the user identifier that is applicable for permission checking. Currently it is always equal to the session user, but in the future there might be "setuid" functions and other facilities to allow the current user to change temporarily. In Unix parlance, the session user is the "real user" and the current user is the "effective user".
Note that these functions have special syntactic status in SQL; they must be called without trailing parentheses.
Deprecated: The function getpgusername() is an obsolete equivalent of current_user.