To get information about current connection from the psql command prompt:
\conninfo
This displays more informations, though.
To change user:
\c - a_new_user
‘-’ substitutes for the current database.
To change database and user:
\c a_new_database a_new_user
The SQL command to get this information:
SELECT current_user;
Examples:
postgres=# \conninfo
You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432"
postgres=# \c a_new_database a_new_user
psql (12.1 (Ubuntu 12.1-1.pgdg16.04+1), server 9.5.20)
You are now connected to database "a_new_database" as user "a_new_user".
a_new_database=# SELECT current_user;
current_user
--------------
a_new_user
(1 row)
This page list few interesting functions and variables.
https://www.postgresql.org/docs/current/static/functions-info.html