Commit 5baf869f authored by Peter Eisentraut's avatar Peter Eisentraut

pg_dump: Remove query truncation in error messages

Remove the behavior that a query mentioned in an error message would be
truncated to 128 characters.  The queries that pg_dump runs are often
longer than that, and this behavior makes analyzing failures harder
unnecessarily.

Discussion: https://www.postgresql.org/message-id/flat/63201ef9-26fb-3f1f-664d-98531678cebc%402ndquadrant.com
parent 4fdb8a82
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#endif #endif
#define DB_MAX_ERR_STMT 128
/* translator: this is a module name */ /* translator: this is a module name */
static const char *modulename = gettext_noop("archiver (db)"); static const char *modulename = gettext_noop("archiver (db)");
...@@ -449,7 +447,6 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc) ...@@ -449,7 +447,6 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc)
{ {
PGconn *conn = AH->connection; PGconn *conn = AH->connection;
PGresult *res; PGresult *res;
char errStmt[DB_MAX_ERR_STMT];
#ifdef NOT_USED #ifdef NOT_USED
fprintf(stderr, "Executing: '%s'\n\n", qry); fprintf(stderr, "Executing: '%s'\n\n", qry);
...@@ -469,16 +466,8 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc) ...@@ -469,16 +466,8 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc)
break; break;
default: default:
/* trouble */ /* trouble */
strncpy(errStmt, qry, DB_MAX_ERR_STMT); /* strncpy required here */
if (errStmt[DB_MAX_ERR_STMT - 1] != '\0')
{
errStmt[DB_MAX_ERR_STMT - 4] = '.';
errStmt[DB_MAX_ERR_STMT - 3] = '.';
errStmt[DB_MAX_ERR_STMT - 2] = '.';
errStmt[DB_MAX_ERR_STMT - 1] = '\0';
}
warn_or_exit_horribly(AH, modulename, "%s: %s Command was: %s\n", warn_or_exit_horribly(AH, modulename, "%s: %s Command was: %s\n",
desc, PQerrorMessage(conn), errStmt); desc, PQerrorMessage(conn), qry);
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment