From 5baf869f74d369319042132ef8cc2d8d4f5b71ce Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 29 Mar 2017 15:17:14 -0400 Subject: [PATCH] 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 --- src/bin/pg_dump/pg_backup_db.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 3b9cd89b4a..2e7d23409a 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -25,8 +25,6 @@ #endif -#define DB_MAX_ERR_STMT 128 - /* translator: this is a module name */ static const char *modulename = gettext_noop("archiver (db)"); @@ -449,7 +447,6 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc) { PGconn *conn = AH->connection; PGresult *res; - char errStmt[DB_MAX_ERR_STMT]; #ifdef NOT_USED fprintf(stderr, "Executing: '%s'\n\n", qry); @@ -469,16 +466,8 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc) break; default: /* 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", - desc, PQerrorMessage(conn), errStmt); + desc, PQerrorMessage(conn), qry); break; } -- 2.40.0