postgresql/src/interfaces/libpq
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
..
po Translation updates 2015-06-28 23:56:55 -04:00
test Update copyright for 2016 2016-01-02 13:33:40 -05:00
.gitignore Revert error-throwing wrappers for the printf family of functions. 2015-05-19 18:19:38 -04:00
Makefile Update copyright for 2016 2016-01-02 13:33:40 -05:00
README Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
bcc32.mak Revert error-throwing wrappers for the printf family of functions. 2015-05-19 18:19:38 -04:00
exports.txt Add libpq support for recreating an error message with different verbosity. 2016-04-03 12:24:54 -04:00
fe-auth.c Avoid possibly-unsafe use of Windows' FormatMessage() function. 2016-03-29 11:55:19 -04:00
fe-auth.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
fe-connect.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
fe-exec.c Add libpq support for recreating an error message with different verbosity. 2016-04-03 12:24:54 -04:00
fe-lobj.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
fe-misc.c Handle invalid libpq sockets in more places 2016-03-08 21:10:33 -05:00
fe-print.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
fe-protocol2.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
fe-protocol3.c Add libpq support for recreating an error message with different verbosity. 2016-04-03 12:24:54 -04:00
fe-secure-openssl.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
fe-secure.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
libpq-events.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
libpq-events.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
libpq-fe.h Add libpq support for recreating an error message with different verbosity. 2016-04-03 12:24:54 -04:00
libpq-int.h Add libpq support for recreating an error message with different verbosity. 2016-04-03 12:24:54 -04:00
libpq.rc.in Update copyright for 2016 2016-01-02 13:33:40 -05:00
nls.mk Add new files to nls.mk 2015-05-17 22:55:17 -04:00
pg_service.conf.sample Remove useless whitespace at end of lines 2010-11-23 22:34:55 +02:00
pqexpbuffer.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
pqexpbuffer.h Update copyright for 2016 2016-01-02 13:33:40 -05:00
pthread-win32.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
win32.c Update copyright for 2016 2016-01-02 13:33:40 -05:00
win32.h Enable compiling with the mingw-w64 32 bit compiler. 2011-12-10 15:35:41 -05:00
win32.mak Revert error-throwing wrappers for the printf family of functions. 2015-05-19 18:19:38 -04:00

README

src/interfaces/libpq/README

This directory contains the C version of Libpq, the POSTGRES frontend library.