check username of database postgresql code example Example 1: postgresql list users postgres=# \du Example 2: postgresql get current user name SELECT current_user;