]> granicus.if.org Git - postgresql/commitdiff
pg_upgrade: adjust logging to use QUERY_ALLOC lengths
authorBruce Momjian <bruce@momjian.us>
Wed, 20 Aug 2014 17:03:58 +0000 (13:03 -0400)
committerBruce Momjian <bruce@momjian.us>
Wed, 20 Aug 2014 17:04:45 +0000 (13:04 -0400)
Allows the logging to print the entire text of failed queries, rather
than a truncated version.

contrib/pg_upgrade/server.c
contrib/pg_upgrade/util.c

index 3d041efbfd0a6de2d195ddedbcaa5751f65ffdc3..fc0d22e2df7e3f61e763cbfadbea0f125ee28b2c 100644 (file)
@@ -104,22 +104,22 @@ cluster_conn_opts(ClusterInfo *cluster)
 PGresult *
 executeQueryOrDie(PGconn *conn, const char *fmt,...)
 {
-       static char command[8192];
+       static char query[QUERY_ALLOC];
        va_list         args;
        PGresult   *result;
        ExecStatusType status;
 
        va_start(args, fmt);
-       vsnprintf(command, sizeof(command), fmt, args);
+       vsnprintf(query, sizeof(query), fmt, args);
        va_end(args);
 
-       pg_log(PG_VERBOSE, "executing: %s\n", command);
-       result = PQexec(conn, command);
+       pg_log(PG_VERBOSE, "executing: %s\n", query);
+       result = PQexec(conn, query);
        status = PQresultStatus(result);
 
        if ((status != PGRES_TUPLES_OK) && (status != PGRES_COMMAND_OK))
        {
-               pg_log(PG_REPORT, "SQL command failed\n%s\n%s\n", command,
+               pg_log(PG_REPORT, "SQL command failed\n%s\n%s\n", query,
                           PQerrorMessage(conn));
                PQclear(result);
                PQfinish(conn);
index 3b94057696d0ad7cae3ead2521af10c39e25c2b1..79da8d7920e1cc85b5703cb9ce2bddaf527a051c 100644 (file)
@@ -86,7 +86,7 @@ __attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 0)))
 void
 pg_log_v(eLogType type, const char *fmt, va_list ap)
 {
-       char            message[MAX_STRING];
+       char            message[QUERY_ALLOC];
 
        vsnprintf(message, sizeof(message), fmt, ap);