Description
Describe the problem
As per the psql docs, %n
is meant to reflect the current SQL user.
This is currently incorrect: it only shows the value in the conn URL and fails to update after SET SESSION AUTHORIZATION.
(Originally when the prompt specifier %n
was implemented, it was not possible to change the username after the SQL session was open. The logic in the shell should have been adapted when SET SESSION AUTHORIZATION was implemented)
To Reproduce
Use %n
in prompt then use SET SESSION AUTHORIZATION.
Expected behavior
The display of %n
should be handled like that of the current database, by extracting the current user known server-side.
Note: this might be the opportunity to also implement %#
which changes the prompt depending on whether the user has admin privileges.
Jira issue: CRDB-28891