postgresql/src
Tom Lane e3161b231c Add libpq support for recreating an error message with different 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 support in libpq for regenerating the error message for
an existing error PGresult at any desired verbosity level.  This is almost
just a matter of refactoring the existing code into a subroutine, but there
is one bit of possibly-needed information that was not getting put into
PGresults: the text of the last query sent to the server.  We must add that
string to the contents of an error PGresult.  But we only need to save it
if it might be used, which with the existing error-formatting code only
happens if there is a PG_DIAG_STATEMENT_POSITION error field, which is
probably pretty rare for errors in production situations.  So really the
overhead when the feature isn't used should be negligible.

Alex Shulgin, reviewed by Daniel Vérité, some improvements by me
2016-04-03 12:24:54 -04:00
..
backend Make all the declarations of WaitEventSetWaitBlock be marked "inline". 2016-04-02 13:55:44 -04:00
bin pgbench: Remove unused parameter 2016-04-01 17:11:18 -03:00
common Refer to a TOKEN_USER payload as a "token user," not as a "user token". 2016-04-01 21:53:18 -04:00
fe_utils Move psql's psqlscan.l into src/fe_utils. 2016-03-24 20:28:47 -04:00
include Add Generic WAL interface 2016-04-01 12:21:48 +03:00
interfaces Add libpq support for recreating an error message with different verbosity. 2016-04-03 12:24:54 -04:00
makefiles Fix typos in comments and doc 2016-01-28 16:47:36 +09:00
pl Copyedit comments and documentation. 2016-04-01 21:53:10 -04:00
port Avoid possibly-unsafe use of Windows' FormatMessage() function. 2016-03-29 11:55:19 -04:00
template Remove some remains from Alpha support removal 2015-10-29 16:40:14 -04:00
test Fix typo in pg_regress.c 2016-04-02 11:12:17 -04:00
timezone Suppress compiler warning. 2016-04-02 13:49:17 -04:00
tools Copyedit comments and documentation. 2016-04-01 21:53:10 -04:00
tutorial Update copyright for 2016 2016-01-02 13:33:40 -05:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create src/fe_utils/, and move stuff into there from pg_dump's dumputils. 2016-03-24 15:55:57 -04:00
Makefile.global.in Create src/fe_utils/, and move stuff into there from pg_dump's dumputils. 2016-03-24 15:55:57 -04:00
Makefile.shlib AIX: Link TRANSFORM modules with their dependencies. 2015-07-15 21:00:26 -04:00
nls-global.mk Setup error context callback for transaction lock waits 2014-03-19 15:10:36 -03:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00