Getting SQLSTATE in psql error messages
Based on a_horse_with_no_name's comment, I started searching around psql and found the solution:

\set VERBOSITY verbose
SELECT * FROM tgvbn();

ERROR:  42883: function vfjkb() does not exist
...


Now that goes into .psqlrc.  Details and further options can be found in the psql documentation.