]> granicus.if.org Git - postgresql/commitdiff
pg_dump: Remove query truncation in error messages
authorPeter Eisentraut <peter_e@gmx.net>
Wed, 29 Mar 2017 19:17:14 +0000 (15:17 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Wed, 29 Mar 2017 19:17:14 +0000 (15:17 -0400)
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

index 3b9cd89b4a862ae18f9ecad287f4d20ef285bcbf..2e7d23409af0df4b04e4e2d4657cb5d54340c845 100644 (file)
@@ -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;
        }