Skip to content

Commit 5baf869

Browse files
committed
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
1 parent 4fdb8a8 commit 5baf869

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

src/bin/pg_dump/pg_backup_db.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#endif
2626

2727

28-
#define DB_MAX_ERR_STMT 128
29-
3028
/* translator: this is a module name */
3129
static const char *modulename = gettext_noop("archiver (db)");
3230

@@ -449,7 +447,6 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc)
449447
{
450448
PGconn *conn = AH->connection;
451449
PGresult *res;
452-
char errStmt[DB_MAX_ERR_STMT];
453450

454451
#ifdef NOT_USED
455452
fprintf(stderr, "Executing: '%s'\n\n", qry);
@@ -469,16 +466,8 @@ ExecuteSqlCommand(ArchiveHandle *AH, const char *qry, const char *desc)
469466
break;
470467
default:
471468
/* trouble */
472-
strncpy(errStmt, qry, DB_MAX_ERR_STMT); /* strncpy required here */
473-
if (errStmt[DB_MAX_ERR_STMT - 1] != '\0')
474-
{
475-
errStmt[DB_MAX_ERR_STMT - 4] = '.';
476-
errStmt[DB_MAX_ERR_STMT - 3] = '.';
477-
errStmt[DB_MAX_ERR_STMT - 2] = '.';
478-
errStmt[DB_MAX_ERR_STMT - 1] = '\0';
479-
}
480469
warn_or_exit_horribly(AH, modulename, "%s: %s Command was: %s\n",
481-
desc, PQerrorMessage(conn), errStmt);
470+
desc, PQerrorMessage(conn), qry);
482471
break;
483472
}
484473

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy