PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References
PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References

PostgreSQL USER Function



The PostgreSQL USER function returns the user name for the current PostgreSQL user. The user name is the name of the user specified when connecting to the PostgreSQL database.

The CURRENT_USER function is a synonym for the USER function.

Syntax

USER

Note: Do not put parentheses () after the USER function.

Return Value

Returns the user name for the current PostgreSQL user.

Example:

The example below shows the usage of USER function.

SELECT USER;

The above query will return the user name for the current PostgreSQL user. Therefore if the user name specified when connecting to the server was 'root', it will return the following:

SELECT USER;
Result: 'root'

❮ PostgreSQL Functions