diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-04-03 12:29:55 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-04-03 12:29:55 -0400 |
commit | 3cc38ca7d21255721d600eb75d7cc6708c14764b (patch) | |
tree | 0e06239939dd831361a1c248c36db94d5ff1e33d /doc/src | |
parent | e3161b231cfaadd4b6438eff2fc1f6cd086f41a9 (diff) |
Add psql \errverbose command to see last server error at full verbosity.
Often, upon getting an unexpected error in psql, one's first wish is that
the verbosity setting had been higher; for example, to be able to see the
schema-name field or the server code location info. Up to now the only way
has been to adjust the VERBOSITY variable and repeat the failing query.
That's a pain, and it doesn't work if the error isn't reproducible.
This commit adds a psql feature that redisplays the most recent server
error at full verbosity, without needing to make any variable changes or
re-execute the failed command. We just need to hang onto the latest error
PGresult in case the user executes \errverbose, and then apply libpq's
new PQresultVerboseErrorMessage() function to it. This will consume
some trivial amount of psql memory, but otherwise the cost when the
feature isn't used should be negligible.
Alex Shulgin, reviewed by Daniel Vérité, some improvements by me
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/psql-ref.sgml | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 385cb599278..e8afc247afe 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1718,6 +1718,20 @@ Tue Oct 26 21:40:57 CEST 1999 <varlistentry> + <term><literal>\errverbose</literal></term> + + <listitem> + <para> + Repeats the most recent server error message at maximum + verbosity, as though <varname>VERBOSITY</varname> were set + to <literal>verbose</> and <varname>SHOW_CONTEXT</varname> were + set to <literal>always</>. + </para> + </listitem> + </varlistentry> + + + <varlistentry> <term><literal>\f [ <replaceable class="parameter">string</replaceable> ]</literal></term> <listitem> @@ -3244,6 +3258,8 @@ bar that context will be shown in error messages, but not in notice or warning messages). This setting has no effect when <varname>VERBOSITY</> is set to <literal>terse</>. + (See also <command>\errverbose</>, for use when you want a verbose + version of the error you just got.) </para> </listitem> </varlistentry> @@ -3286,6 +3302,8 @@ bar This variable can be set to the values <literal>default</>, <literal>verbose</>, or <literal>terse</> to control the verbosity of error reports. + (See also <command>\errverbose</>, for use when you want a verbose + version of the error you just got.) </para> </listitem> </varlistentry> |