mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
Revise syntax-error reporting behavior to give pleasant results for
errors in internally-generated queries, such as those submitted by plpgsql functions. Per recent discussions with Fabien Coelho.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.11 2003/12/28 17:43:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-protocol3.c,v 1.12 2004/03/21 22:29:11 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -640,6 +640,16 @@ pqGetErrorNotice3(PGconn *conn, bool isError)
|
||||
/* translator: %s represents a digit string */
|
||||
appendPQExpBuffer(&workBuf, libpq_gettext(" at character %s"), val);
|
||||
}
|
||||
else
|
||||
{
|
||||
val = PQresultErrorField(res, PG_DIAG_INTERNAL_POSITION);
|
||||
if (val)
|
||||
{
|
||||
/* translator: %s represents a digit string */
|
||||
appendPQExpBuffer(&workBuf, libpq_gettext(" at character %s"),
|
||||
val);
|
||||
}
|
||||
}
|
||||
appendPQExpBufferChar(&workBuf, '\n');
|
||||
if (conn->verbosity != PQERRORS_TERSE)
|
||||
{
|
||||
@@ -649,6 +659,9 @@ pqGetErrorNotice3(PGconn *conn, bool isError)
|
||||
val = PQresultErrorField(res, PG_DIAG_MESSAGE_HINT);
|
||||
if (val)
|
||||
appendPQExpBuffer(&workBuf, libpq_gettext("HINT: %s\n"), val);
|
||||
val = PQresultErrorField(res, PG_DIAG_INTERNAL_QUERY);
|
||||
if (val)
|
||||
appendPQExpBuffer(&workBuf, libpq_gettext("QUERY: %s\n"), val);
|
||||
val = PQresultErrorField(res, PG_DIAG_CONTEXT);
|
||||
if (val)
|
||||
appendPQExpBuffer(&workBuf, libpq_gettext("CONTEXT: %s\n"), val);
|
||||
|
||||
Reference in New Issue
Block a user