Investigating a psql error
Error messages can sometimes be cryptic, and you may be left wondering, why did this error happen at all?
For this purpose, psql
recognizes two variables – VERBOSITY
and CONTEXT
; valid values are terse
, default
, or verbose
for the former and never
, errors
, or always
for the latter. A more verbose error message will hopefully specify extra details, and the context information will be included. Here is an example to show the difference:
postgres=# \set VERBOSITY terse postgres=# \set CONTEXT never postgres=# select * from missingtable; ERROR: relation "missingtable" does not exist at character 15
This is quite a simple error, so we don't need the extra details, but it is nevertheless useful for illustrating the extra detail you get when raising verbosity and enabling context information:
postgres=# \set VERBOSITY verbose postgres...