I whish to display the version of the server I am connected to in the command-line (console) interface prompt. From what I read in the documentation, it is possible to execute a shell command, it is possible to display a psql variable value.
The idea is to get the server's version information on connection and use it in the client's prompt. How can I (in the .psqlrc
file ?) assign the server version in a psql variable ?
Edit: Jack Douglas♦ has the right answer by pointing out the \gset
feature. It ended up with a
show server_version
\gset
\set PROMPT1 '%:server_version: >'
Thank you.