debugsqlModerate
Getting SQLSTATE in psql error messages
Viewed 0 times
errorgettingpsqlmessagessqlstate
Problem
I have the following problem.
Since Appendix A of the official documentation only states error_codes and conditional names but not the actual messages, one can only guess that "No function matches..." refers to
Controls the amount of detail written in the server log for each
message that is logged.
Well, I can consult the logs for this piece of information, but is there any means of including it in the error messages?
SELECT * FROM tgvbn();
ERROR: function tgvbn() does not exist
LINE 1: SELECT * FROM tgvbn();
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.Since Appendix A of the official documentation only states error_codes and conditional names but not the actual messages, one can only guess that "No function matches..." refers to
42883 / undefined_function. I can set log_error_verbosity = verbose in postgresql.conf - but that will affect the logs, not the messages returned to the client:Controls the amount of detail written in the server log for each
message that is logged.
Well, I can consult the logs for this piece of information, but is there any means of including it in the error messages?
Solution
Based on a_horse_with_no_name's comment, I started searching around
Now that goes into
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.Code Snippets
\set VERBOSITY verbose
SELECT * FROM tgvbn();
ERROR: 42883: function vfjkb() does not exist
...Context
StackExchange Database Administrators Q#28795, answer score: 10
Revisions (0)
No revisions yet.