diff options
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r-- | src/bin/psql/common.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index 2a6be545caf..3b1a1228c1e 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2003, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.84 2004/03/15 10:41:26 ishii Exp $ + * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.85 2004/03/21 22:29:11 tgl Exp $ */ #include "postgres_fe.h" #include "common.h" @@ -364,18 +364,19 @@ ReportSyntaxErrorPosition(const PGresult *result, const char *query) bool beg_trunc, end_trunc; PQExpBufferData msg; - if (query == NULL) - return; /* nothing to do */ + if (pset.verbosity == PQERRORS_TERSE) + return; + sp = PQresultErrorField(result, PG_DIAG_STATEMENT_POSITION); if (sp == NULL) - return; /* no syntax error location */ - /* - * We punt if the report contains any CONTEXT. This typically means that - * the syntax error is from inside a function, and the cursor position - * is not relevant to the original query string. - */ - if (PQresultErrorField(result, PG_DIAG_CONTEXT) != NULL) - return; + { + sp = PQresultErrorField(result, PG_DIAG_INTERNAL_POSITION); + if (sp == NULL) + return; /* no syntax error */ + query = PQresultErrorField(result, PG_DIAG_INTERNAL_QUERY); + } + if (query == NULL) + return; /* nothing to reference location to */ if (sscanf(sp, "%d", &loc) != 1) { |