Skip to content

Commit 7567d94

Browse files
committed
pg_upgrade: adjust logging to use QUERY_ALLOC lengths
Allows the logging to print the entire text of failed queries, rather than a truncated version.
1 parent 02587dc commit 7567d94

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

contrib/pg_upgrade/server.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,22 +104,22 @@ cluster_conn_opts(ClusterInfo *cluster)
104104
PGresult *
105105
executeQueryOrDie(PGconn *conn, const char *fmt,...)
106106
{
107-
static char command[8192];
107+
static char query[QUERY_ALLOC];
108108
va_list args;
109109
PGresult *result;
110110
ExecStatusType status;
111111

112112
va_start(args, fmt);
113-
vsnprintf(command, sizeof(command), fmt, args);
113+
vsnprintf(query, sizeof(query), fmt, args);
114114
va_end(args);
115115

116-
pg_log(PG_VERBOSE, "executing: %s\n", command);
117-
result = PQexec(conn, command);
116+
pg_log(PG_VERBOSE, "executing: %s\n", query);
117+
result = PQexec(conn, query);
118118
status = PQresultStatus(result);
119119

120120
if ((status != PGRES_TUPLES_OK) && (status != PGRES_COMMAND_OK))
121121
{
122-
pg_log(PG_REPORT, "SQL command failed\n%s\n%s\n", command,
122+
pg_log(PG_REPORT, "SQL command failed\n%s\n%s\n", query,
123123
PQerrorMessage(conn));
124124
PQclear(result);
125125
PQfinish(conn);

contrib/pg_upgrade/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0)))
8686
void
8787
pg_log_v(eLogType type, const char *fmt, va_list ap)
8888
{
89-
char message[MAX_STRING];
89+
char message[QUERY_ALLOC];
9090

9191
vsnprintf(message, sizeof(message), fmt, ap);
9292

0 commit comments

Comments
 (0)