]> granicus.if.org Git - postgresql/commitdiff
pg_basebackup: stylistic adjustments
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 31 Jul 2012 14:11:11 +0000 (10:11 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 31 Jul 2012 15:02:39 +0000 (11:02 -0400)
The most user-visible part of this is to change the long options
--statusint and --noloop to --status-interval and --no-loop,
respectively, per discussion.

Also, consistently enclose file names in double quotes, per our
conventions; and consistently use the term "transaction log file" to
talk about WAL segments.  (Someday we may need to go over this
terminology and make it consistent across the whole source code.)

Finally, reflow the code to better fit in 80 columns, and have pgindent
fix it up some more.

doc/src/sgml/ref/pg_basebackup.sgml
doc/src/sgml/ref/pg_receivexlog.sgml
src/bin/pg_basebackup/pg_basebackup.c
src/bin/pg_basebackup/pg_receivexlog.c
src/bin/pg_basebackup/receivelog.c
src/bin/pg_basebackup/streamutil.c

index d22c0c5eb0ec0daf4592118dbccef1ef4baffd17..cec66559ce3bfe7260a86e807a8078704f6cf104 100644 (file)
@@ -346,7 +346,7 @@ PostgreSQL documentation
     <variablelist>
      <varlistentry>
       <term><option>-s <replaceable class="parameter">interval</replaceable></option></term>
-      <term><option>--statusint=<replaceable class="parameter">interval</replaceable></option></term>
+      <term><option>--status-interval=<replaceable class="parameter">interval</replaceable></option></term>
       <listitem>
        <para>
         Specifies the number of seconds between status packets sent back to the
index 63cff4788036c93a09482eb295456a326154d971..64cb81d2ef86e2d4ba5cbcc8b5909a93dd836637 100644 (file)
@@ -96,7 +96,7 @@ PostgreSQL documentation
     <variablelist>
      <varlistentry>
       <term><option>-n</option></term>
-      <term><option>--noloop</option></term>
+      <term><option>--no-loop</option></term>
       <listitem>
        <para>
         Don't loop on connection errors. Instead, exit right away with
@@ -124,7 +124,7 @@ PostgreSQL documentation
     <variablelist>
      <varlistentry>
       <term><option>-s <replaceable class="parameter">interval</replaceable></option></term>
-      <term><option>--statusint=<replaceable class="parameter">interval</replaceable></option></term>
+      <term><option>--status-interval=<replaceable class="parameter">interval</replaceable></option></term>
       <listitem>
        <para>
         Specifies the number of seconds between status packets sent back to the
index a6fd3ae2040e16c398811a9b667d5471a0553c91..25f67da0e2566b8eb34375652a08c2780dadbe4f 100644 (file)
@@ -79,7 +79,8 @@ static void ReceiveTarFile(PGconn *conn, PGresult *res, int rownum);
 static void ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum);
 static void BaseBackup(void);
 
-static bool reached_end_position(XLogRecPtr segendpos, uint32 timeline, bool segment_finished);
+static bool reached_end_position(XLogRecPtr segendpos, uint32 timeline,
+                                        bool segment_finished);
 
 #ifdef HAVE_LIBZ
 static const char *
@@ -96,7 +97,6 @@ get_gz_error(gzFile gzf)
 }
 #endif
 
-
 static void
 usage(void)
 {
@@ -105,28 +105,29 @@ usage(void)
        printf(_("Usage:\n"));
        printf(_("  %s [OPTION]...\n"), progname);
        printf(_("\nOptions controlling the output:\n"));
-       printf(_("  -D, --pgdata=DIRECTORY   receive base backup into directory\n"));
-       printf(_("  -F, --format=p|t         output format (plain (default), tar)\n"));
-       printf(_("  -x, --xlog               include required WAL files in backup (fetch mode)\n"));
+       printf(_("  -D, --pgdata=DIRECTORY receive base backup into directory\n"));
+       printf(_("  -F, --format=p|t       output format (plain (default), tar)\n"));
+       printf(_("  -x, --xlog             include required WAL files in backup (fetch mode)\n"));
        printf(_("  -X, --xlog-method=fetch|stream\n"
-                  "                           include required WAL files with specified method\n"));
-       printf(_("  -z, --gzip               compress tar output\n"));
-       printf(_("  -Z, --compress=0-9       compress tar output with given compression level\n"));
+                        "                         include required WAL files with specified method\n"));
+       printf(_("  -z, --gzip             compress tar output\n"));
+       printf(_("  -Z, --compress=0-9     compress tar output with given compression level\n"));
        printf(_("\nGeneral options:\n"));
        printf(_("  -c, --checkpoint=fast|spread\n"
-                  "                           set fast or spread checkpointing\n"));
-       printf(_("  -l, --label=LABEL        set backup label\n"));
-       printf(_("  -P, --progress           show progress information\n"));
-       printf(_("  -v, --verbose            output verbose messages\n"));
-       printf(_("  -V, --version            output version information, then exit\n"));
-       printf(_("  -?, --help               show this help, then exit\n"));
+                        "                         set fast or spread checkpointing\n"));
+       printf(_("  -l, --label=LABEL      set backup label\n"));
+       printf(_("  -P, --progress         show progress information\n"));
+       printf(_("  -v, --verbose          output verbose messages\n"));
+       printf(_("  -V, --version          output version information, then exit\n"));
+       printf(_("  -?, --help             show this help, then exit\n"));
        printf(_("\nConnection options:\n"));
-       printf(_("  -s, --statusint=INTERVAL time between status packets sent to server (in seconds)\n"));
-       printf(_("  -h, --host=HOSTNAME      database server host or socket directory\n"));
-       printf(_("  -p, --port=PORT          database server port number\n"));
-       printf(_("  -U, --username=NAME      connect as specified database user\n"));
-       printf(_("  -w, --no-password        never prompt for password\n"));
-       printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
+       printf(_("  -s, --status-interval=INTERVAL\n"
+                        "                         time between status packets sent to server (in seconds)\n"));
+       printf(_("  -h, --host=HOSTNAME    database server host or socket directory\n"));
+       printf(_("  -p, --port=PORT        database server port number\n"));
+       printf(_("  -U, --username=NAME    connect as specified database user\n"));
+       printf(_("  -w, --no-password      never prompt for password\n"));
+       printf(_("  -W, --password         force password prompt (should happen automatically)\n"));
        printf(_("\nReport bugs to <pgsql-bugs@postgresql.org>.\n"));
 }
 
@@ -140,7 +141,8 @@ usage(void)
  * time to stop.
  */
 static bool
-reached_end_position(XLogRecPtr segendpos, uint32 timeline, bool segment_finished)
+reached_end_position(XLogRecPtr segendpos, uint32 timeline,
+                                        bool segment_finished)
 {
        if (!has_xlogendptr)
        {
@@ -176,7 +178,8 @@ reached_end_position(XLogRecPtr segendpos, uint32 timeline, bool segment_finishe
 
                        if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2)
                        {
-                               fprintf(stderr, _("%s: could not parse xlog end position \"%s\"\n"),
+                               fprintf(stderr,
+                                 _("%s: could not parse transaction log location \"%s\"\n"),
                                                progname, xlogend);
                                exit(1);
                        }
@@ -234,7 +237,8 @@ LogStreamerMain(logstreamer_param *param)
 {
        if (!ReceiveXlogStream(param->bgconn, param->startptr, param->timeline,
                                                   param->sysidentifier, param->xlogdir,
-                                               reached_end_position, standby_message_timeout, true))
+                                                  reached_end_position, standby_message_timeout,
+                                                  true))
 
                /*
                 * Any errors will already have been reported in the function process,
@@ -266,7 +270,8 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
        /* Convert the starting position */
        if (sscanf(startpos, "%X/%X", &hi, &lo) != 2)
        {
-               fprintf(stderr, _("%s: invalid format of xlog location: %s\n"),
+               fprintf(stderr,
+                               _("%s: could not parse transaction log location \"%s\"\n"),
                                progname, startpos);
                disconnect_and_exit(1);
        }
@@ -278,7 +283,8 @@ StartLogStreamer(char *startpos, uint32 timeline, char *sysidentifier)
        /* Create our background pipe */
        if (pipe(bgpipe) < 0)
        {
-               fprintf(stderr, _("%s: could not create pipe for background process: %s\n"),
+               fprintf(stderr,
+                               _("%s: could not create pipe for background process: %s\n"),
                                progname, strerror(errno));
                disconnect_and_exit(1);
        }
@@ -407,7 +413,8 @@ progress_report(int tablespacenum, const char *filename)
         * translatable strings.  And we only test for INT64_FORMAT availability
         * in snprintf, not fprintf.
         */
-       snprintf(totaldone_str, sizeof(totaldone_str), INT64_FORMAT, totaldone / 1024);
+       snprintf(totaldone_str, sizeof(totaldone_str), INT64_FORMAT,
+                        totaldone / 1024);
        snprintf(totalsize_str, sizeof(totalsize_str), INT64_FORMAT, totalsize);
 
        if (verbose)
@@ -422,20 +429,23 @@ progress_report(int tablespacenum, const char *filename)
                                        ngettext("%s/%s kB (100%%), %d/%d tablespace %35s",
                                                         "%s/%s kB (100%%), %d/%d tablespaces %35s",
                                                         tablespacecount),
-                       totaldone_str, totalsize_str, tablespacenum, tablespacecount, "");
+                                       totaldone_str, totalsize_str,
+                                       tablespacenum, tablespacecount, "");
                else
                        fprintf(stderr,
                                        ngettext("%s/%s kB (%d%%), %d/%d tablespace (%-30.30s)",
                                                         "%s/%s kB (%d%%), %d/%d tablespaces (%-30.30s)",
                                                         tablespacecount),
-                                       totaldone_str, totalsize_str, percent, tablespacenum, tablespacecount, filename);
+                                       totaldone_str, totalsize_str, percent,
+                                       tablespacenum, tablespacecount, filename);
        }
        else
                fprintf(stderr,
                                ngettext("%s/%s kB (%d%%), %d/%d tablespace",
                                                 "%s/%s kB (%d%%), %d/%d tablespaces",
                                                 tablespacecount),
-                               totaldone_str, totalsize_str, percent, tablespacenum, tablespacecount);
+                               totaldone_str, totalsize_str, percent,
+                               tablespacenum, tablespacecount);
 
        fprintf(stderr, "\r");
 }
@@ -463,7 +473,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
 #endif
 
        if (PQgetisnull(res, rownum, 0))
-
+       {
                /*
                 * Base tablespaces
                 */
@@ -473,9 +483,11 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                        if (compresslevel != 0)
                        {
                                ztarfile = gzdopen(dup(fileno(stdout)), "wb");
-                               if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
+                               if (gzsetparams(ztarfile, compresslevel,
+                                                               Z_DEFAULT_STRATEGY) != Z_OK)
                                {
-                                       fprintf(stderr, _("%s: could not set compression level %d: %s\n"),
+                                       fprintf(stderr,
+                                                       _("%s: could not set compression level %d: %s\n"),
                                                        progname, compresslevel, get_gz_error(ztarfile));
                                        disconnect_and_exit(1);
                                }
@@ -491,9 +503,11 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                        {
                                snprintf(filename, sizeof(filename), "%s/base.tar.gz", basedir);
                                ztarfile = gzopen(filename, "wb");
-                               if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
+                               if (gzsetparams(ztarfile, compresslevel,
+                                                               Z_DEFAULT_STRATEGY) != Z_OK)
                                {
-                                       fprintf(stderr, _("%s: could not set compression level %d: %s\n"),
+                                       fprintf(stderr,
+                                                       _("%s: could not set compression level %d: %s\n"),
                                                        progname, compresslevel, get_gz_error(ztarfile));
                                        disconnect_and_exit(1);
                                }
@@ -505,6 +519,7 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                                tarfile = fopen(filename, "wb");
                        }
                }
+       }
        else
        {
                /*
@@ -513,11 +528,14 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
 #ifdef HAVE_LIBZ
                if (compresslevel != 0)
                {
-                       snprintf(filename, sizeof(filename), "%s/%s.tar.gz", basedir, PQgetvalue(res, rownum, 0));
+                       snprintf(filename, sizeof(filename), "%s/%s.tar.gz", basedir,
+                                        PQgetvalue(res, rownum, 0));
                        ztarfile = gzopen(filename, "wb");
-                       if (gzsetparams(ztarfile, compresslevel, Z_DEFAULT_STRATEGY) != Z_OK)
+                       if (gzsetparams(ztarfile, compresslevel,
+                                                       Z_DEFAULT_STRATEGY) != Z_OK)
                        {
-                               fprintf(stderr, _("%s: could not set compression level %d: %s\n"),
+                               fprintf(stderr,
+                                               _("%s: could not set compression level %d: %s\n"),
                                                progname, compresslevel, get_gz_error(ztarfile));
                                disconnect_and_exit(1);
                        }
@@ -525,7 +543,8 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                else
 #endif
                {
-                       snprintf(filename, sizeof(filename), "%s/%s.tar", basedir, PQgetvalue(res, rownum, 0));
+                       snprintf(filename, sizeof(filename), "%s/%s.tar", basedir,
+                                        PQgetvalue(res, rownum, 0));
                        tarfile = fopen(filename, "wb");
                }
        }
@@ -536,7 +555,8 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                if (!ztarfile)
                {
                        /* Compression is in use */
-                       fprintf(stderr, _("%s: could not create compressed file \"%s\": %s\n"),
+                       fprintf(stderr,
+                                       _("%s: could not create compressed file \"%s\": %s\n"),
                                        progname, filename, get_gz_error(ztarfile));
                        disconnect_and_exit(1);
                }
@@ -589,9 +609,11 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
 #ifdef HAVE_LIBZ
                        if (ztarfile != NULL)
                        {
-                               if (gzwrite(ztarfile, zerobuf, sizeof(zerobuf)) != sizeof(zerobuf))
+                               if (gzwrite(ztarfile, zerobuf, sizeof(zerobuf)) !=
+                                       sizeof(zerobuf))
                                {
-                                       fprintf(stderr, _("%s: could not write to compressed file \"%s\": %s\n"),
+                                       fprintf(stderr,
+                                       _("%s: could not write to compressed file \"%s\": %s\n"),
                                                        progname, filename, get_gz_error(ztarfile));
                                        disconnect_and_exit(1);
                                }
@@ -601,7 +623,8 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                        {
                                if (fwrite(zerobuf, sizeof(zerobuf), 1, tarfile) != 1)
                                {
-                                       fprintf(stderr, _("%s: could not write to file \"%s\": %s\n"),
+                                       fprintf(stderr,
+                                                       _("%s: could not write to file \"%s\": %s\n"),
                                                        progname, filename, strerror(errno));
                                        disconnect_and_exit(1);
                                }
@@ -612,7 +635,8 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                        {
                                if (gzclose(ztarfile) != 0)
                                {
-                                       fprintf(stderr, _("%s: could not close compressed file \"%s\": %s\n"),
+                                       fprintf(stderr,
+                                          _("%s: could not close compressed file \"%s\": %s\n"),
                                                        progname, filename, get_gz_error(ztarfile));
                                        disconnect_and_exit(1);
                                }
@@ -624,7 +648,8 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                                {
                                        if (fclose(tarfile) != 0)
                                        {
-                                               fprintf(stderr, _("%s: could not close file \"%s\": %s\n"),
+                                               fprintf(stderr,
+                                                               _("%s: could not close file \"%s\": %s\n"),
                                                                progname, filename, strerror(errno));
                                                disconnect_and_exit(1);
                                        }
@@ -645,7 +670,8 @@ ReceiveTarFile(PGconn *conn, PGresult *res, int rownum)
                {
                        if (gzwrite(ztarfile, copybuf, r) != r)
                        {
-                               fprintf(stderr, _("%s: could not write to compressed file \"%s\": %s\n"),
+                               fprintf(stderr,
+                                       _("%s: could not write to compressed file \"%s\": %s\n"),
                                                progname, filename, get_gz_error(ztarfile));
                                disconnect_and_exit(1);
                        }
@@ -773,7 +799,8 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
                        /*
                         * First part of header is zero terminated filename
                         */
-                       snprintf(filename, sizeof(filename), "%s/%s", current_path, copybuf);
+                       snprintf(filename, sizeof(filename), "%s/%s", current_path,
+                                        copybuf);
                        if (filename[strlen(filename) - 1] == '/')
                        {
                                /*
@@ -802,7 +829,8 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
                                        }
 #ifndef WIN32
                                        if (chmod(filename, (mode_t) filemode))
-                                               fprintf(stderr, _("%s: could not set permissions on directory \"%s\": %s\n"),
+                                               fprintf(stderr,
+                                                               _("%s: could not set permissions on directory \"%s\": %s\n"),
                                                                progname, filename, strerror(errno));
 #endif
                                }
@@ -822,7 +850,8 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
                                }
                                else
                                {
-                                       fprintf(stderr, _("%s: unrecognized link indicator \"%c\"\n"),
+                                       fprintf(stderr,
+                                                       _("%s: unrecognized link indicator \"%c\"\n"),
                                                        progname, copybuf[156]);
                                        disconnect_and_exit(1);
                                }
@@ -900,7 +929,9 @@ ReceiveAndUnpackTarFile(PGconn *conn, PGresult *res, int rownum)
 
        if (file != NULL)
        {
-               fprintf(stderr, _("%s: COPY stream ended before last file was finished\n"), progname);
+               fprintf(stderr,
+                               _("%s: COPY stream ended before last file was finished\n"),
+                               progname);
                disconnect_and_exit(1);
        }
 
@@ -935,14 +966,15 @@ BaseBackup(void)
        res = PQexec(conn, "IDENTIFY_SYSTEM");
        if (PQresultStatus(res) != PGRES_TUPLES_OK)
        {
-               fprintf(stderr, _("%s: could not identify system: %s"),
-                               progname, PQerrorMessage(conn));
+               fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
+                               progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
                disconnect_and_exit(1);
        }
        if (PQntuples(res) != 1 || PQnfields(res) != 3)
        {
-               fprintf(stderr, _("%s: could not identify system, got %d rows and %d fields\n"),
-                               progname, PQntuples(res), PQnfields(res));
+               fprintf(stderr,
+                               _("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d fields\n"),
+                               progname, PQntuples(res), PQnfields(res), 1, 3);
                disconnect_and_exit(1);
        }
        sysidentifier = strdup(PQgetvalue(res, 0, 0));
@@ -953,7 +985,8 @@ BaseBackup(void)
         * Start the actual backup
         */
        PQescapeStringConn(conn, escaped_label, label, sizeof(escaped_label), &i);
-       snprintf(current_path, sizeof(current_path), "BASE_BACKUP LABEL '%s' %s %s %s %s",
+       snprintf(current_path, sizeof(current_path),
+                        "BASE_BACKUP LABEL '%s' %s %s %s %s",
                         escaped_label,
                         showprogress ? "PROGRESS" : "",
                         includewal && !streamwal ? "WAL" : "",
@@ -962,8 +995,8 @@ BaseBackup(void)
 
        if (PQsendQuery(conn, current_path) == 0)
        {
-               fprintf(stderr, _("%s: could not send base backup command: %s"),
-                               progname, PQerrorMessage(conn));
+               fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
+                               progname, "BASE_BACKUP", PQerrorMessage(conn));
                disconnect_and_exit(1);
        }
 
@@ -985,7 +1018,7 @@ BaseBackup(void)
        }
        strcpy(xlogstart, PQgetvalue(res, 0, 0));
        if (verbose && includewal)
-               fprintf(stderr, "xlog start point: %s\n", xlogstart);
+               fprintf(stderr, "transaction log start point: %s\n", xlogstart);
        PQclear(res);
        MemSet(xlogend, 0, sizeof(xlogend));
 
@@ -1029,7 +1062,8 @@ BaseBackup(void)
         */
        if (format == 't' && strcmp(basedir, "-") == 0 && PQntuples(res) > 1)
        {
-               fprintf(stderr, _("%s: can only write single tablespace to stdout, database has %d\n"),
+               fprintf(stderr,
+                               _("%s: can only write single tablespace to stdout, database has %d\n"),
                                progname, PQntuples(res));
                disconnect_and_exit(1);
        }
@@ -1070,19 +1104,21 @@ BaseBackup(void)
        res = PQgetResult(conn);
        if (PQresultStatus(res) != PGRES_TUPLES_OK)
        {
-               fprintf(stderr, _("%s: could not get WAL end position from server: %s"),
+               fprintf(stderr,
+                _("%s: could not get transaction log end position from server: %s"),
                                progname, PQerrorMessage(conn));
                disconnect_and_exit(1);
        }
        if (PQntuples(res) != 1)
        {
-               fprintf(stderr, _("%s: no WAL end position returned from server\n"),
+               fprintf(stderr,
+                        _("%s: no transaction log end position returned from server\n"),
                                progname);
                disconnect_and_exit(1);
        }
        strcpy(xlogend, PQgetvalue(res, 0, 0));
        if (verbose && includewal)
-               fprintf(stderr, "xlog end point: %s\n", xlogend);
+               fprintf(stderr, "transaction log end point: %s\n", xlogend);
        PQclear(res);
 
        res = PQgetResult(conn);
@@ -1105,12 +1141,14 @@ BaseBackup(void)
 #endif
 
                if (verbose)
-                       fprintf(stderr, _("%s: waiting for background process to finish streaming...\n"), progname);
+                       fprintf(stderr,
+                                       _("%s: waiting for background process to finish streaming...\n"), progname);
 
 #ifndef WIN32
                if (write(bgpipe[1], xlogend, strlen(xlogend)) != strlen(xlogend))
                {
-                       fprintf(stderr, _("%s: could not send command to background pipe: %s\n"),
+                       fprintf(stderr,
+                                       _("%s: could not send command to background pipe: %s\n"),
                                        progname, strerror(errno));
                        disconnect_and_exit(1);
                }
@@ -1151,7 +1189,8 @@ BaseBackup(void)
                 */
                if (sscanf(xlogend, "%X/%X", &hi, &lo) != 2)
                {
-                       fprintf(stderr, _("%s: could not parse xlog end position \"%s\"\n"),
+                       fprintf(stderr,
+                                 _("%s: could not parse transaction log location \"%s\"\n"),
                                        progname, xlogend);
                        disconnect_and_exit(1);
                }
@@ -1159,7 +1198,8 @@ BaseBackup(void)
                InterlockedIncrement(&has_xlogendptr);
 
                /* First wait for the thread to exit */
-               if (WaitForSingleObjectEx((HANDLE) bgchild, INFINITE, FALSE) != WAIT_OBJECT_0)
+               if (WaitForSingleObjectEx((HANDLE) bgchild, INFINITE, FALSE) !=
+                       WAIT_OBJECT_0)
                {
                        _dosmaperr(GetLastError());
                        fprintf(stderr, _("%s: could not wait for child thread: %s\n"),
@@ -1213,7 +1253,7 @@ main(int argc, char **argv)
                {"username", required_argument, NULL, 'U'},
                {"no-password", no_argument, NULL, 'w'},
                {"password", no_argument, NULL, 'W'},
-               {"statusint", required_argument, NULL, 's'},
+               {"status-interval", required_argument, NULL, 's'},
                {"verbose", no_argument, NULL, 'v'},
                {"progress", no_argument, NULL, 'P'},
                {NULL, 0, NULL, 0}
@@ -1255,7 +1295,8 @@ main(int argc, char **argv)
                                        format = 't';
                                else
                                {
-                                       fprintf(stderr, _("%s: invalid output format \"%s\", must be \"plain\" or \"tar\"\n"),
+                                       fprintf(stderr,
+                                                       _("%s: invalid output format \"%s\", must be \"plain\" or \"tar\"\n"),
                                                        progname, optarg);
                                        exit(1);
                                }
@@ -1263,7 +1304,8 @@ main(int argc, char **argv)
                        case 'x':
                                if (includewal)
                                {
-                                       fprintf(stderr, _("%s: cannot specify both --xlog and --xlog-method\n"),
+                                       fprintf(stderr,
+                                        _("%s: cannot specify both --xlog and --xlog-method\n"),
                                                        progname);
                                        exit(1);
                                }
@@ -1274,7 +1316,8 @@ main(int argc, char **argv)
                        case 'X':
                                if (includewal)
                                {
-                                       fprintf(stderr, _("%s: cannot specify both --xlog and --xlog-method\n"),
+                                       fprintf(stderr,
+                                        _("%s: cannot specify both --xlog and --xlog-method\n"),
                                                        progname);
                                        exit(1);
                                }
@@ -1288,7 +1331,8 @@ main(int argc, char **argv)
                                        streamwal = true;
                                else
                                {
-                                       fprintf(stderr, _("%s: invalid xlog-method option \"%s\", must be empty, \"fetch\", or \"stream\"\n"),
+                                       fprintf(stderr,
+                                                       _("%s: invalid xlog-method option \"%s\", must be empty, \"fetch\", or \"stream\"\n"),
                                                        progname, optarg);
                                        exit(1);
                                }
@@ -1430,7 +1474,6 @@ main(int argc, char **argv)
        if (format == 'p' || strcmp(basedir, "-") != 0)
                verify_dir_is_empty_or_create(basedir);
 
-
        BaseBackup();
 
        return 0;
index c4e1d2a682ec3f3b6a893b41834f66daf3239a51..3a30a1354034701ef6cdbb96b5a8b780cd83d786 100644 (file)
@@ -45,9 +45,11 @@ volatile bool time_to_abort = false;
 
 
 static void usage(void);
-static XLogRecPtr FindStreamingStart(XLogRecPtr currentpos, uint32 currenttimeline);
+static XLogRecPtr FindStreamingStart(XLogRecPtr currentpos,
+                                  uint32 currenttimeline);
 static void StreamLog();
-static bool stop_streaming(XLogRecPtr segendpos, uint32 timeline, bool segment_finished);
+static bool stop_streaming(XLogRecPtr segendpos, uint32 timeline,
+                          bool segment_finished);
 
 static void
 usage(void)
@@ -57,18 +59,19 @@ usage(void)
        printf(_("Usage:\n"));
        printf(_("  %s [OPTION]...\n"), progname);
        printf(_("\nOptions:\n"));
-       printf(_("  -D, --directory=DIR      receive transaction log files into this directory\n"));
-       printf(_("  -n, --noloop             do not loop on connection lost\n"));
-       printf(_("  -v, --verbose            output verbose messages\n"));
-       printf(_("  -V, --version            output version information, then exit\n"));
-       printf(_("  -?, --help               show this help, then exit\n"));
+       printf(_("  -D, --directory=DIR    receive transaction log files into this directory\n"));
+       printf(_("  -n, --no-loop          do not loop on connection lost\n"));
+       printf(_("  -v, --verbose          output verbose messages\n"));
+       printf(_("  -V, --version          output version information, then exit\n"));
+       printf(_("  -?, --help             show this help, then exit\n"));
        printf(_("\nConnection options:\n"));
-       printf(_("  -s, --statusint=INTERVAL time between status packets sent to server (in seconds)\n"));
-       printf(_("  -h, --host=HOSTNAME      database server host or socket directory\n"));
-       printf(_("  -p, --port=PORT          database server port number\n"));
-       printf(_("  -U, --username=NAME      connect as specified database user\n"));
-       printf(_("  -w, --no-password        never prompt for password\n"));
-       printf(_("  -W, --password           force password prompt (should happen automatically)\n"));
+       printf(_("  -s, --status-interval=INTERVAL\n"
+                        "                         time between status packets sent to server (in seconds)\n"));
+       printf(_("  -h, --host=HOSTNAME    database server host or socket directory\n"));
+       printf(_("  -p, --port=PORT        database server port number\n"));
+       printf(_("  -U, --username=NAME    connect as specified database user\n"));
+       printf(_("  -w, --no-password      never prompt for password\n"));
+       printf(_("  -W, --password         force password prompt (should happen automatically)\n"));
        printf(_("\nReport bugs to <pgsql-bugs@postgresql.org>.\n"));
 }
 
@@ -123,7 +126,8 @@ FindStreamingStart(XLogRecPtr currentpos, uint32 currenttimeline)
                                        seg;
                XLogSegNo       segno;
 
-               if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0)
+               if (strcmp(dirent->d_name, ".") == 0 ||
+                       strcmp(dirent->d_name, "..") == 0)
                        continue;
 
                /* xlog files are always 24 characters */
@@ -149,7 +153,8 @@ FindStreamingStart(XLogRecPtr currentpos, uint32 currenttimeline)
                 */
                if (sscanf(dirent->d_name, "%08X%08X%08X", &tli, &log, &seg) != 3)
                {
-                       fprintf(stderr, _("%s: could not parse xlog filename \"%s\"\n"),
+                       fprintf(stderr,
+                                _("%s: could not parse transaction log file name \"%s\"\n"),
                                        progname, dirent->d_name);
                        disconnect_and_exit(1);
                }
@@ -179,7 +184,8 @@ FindStreamingStart(XLogRecPtr currentpos, uint32 currenttimeline)
                }
                else
                {
-                       fprintf(stderr, _("%s: segment file '%s' is incorrect size %d, skipping\n"),
+                       fprintf(stderr,
+                         _("%s: segment file \"%s\" has incorrect size %d, skipping\n"),
                                        progname, dirent->d_name, (int) statbuf.st_size);
                        continue;
                }
@@ -232,20 +238,22 @@ StreamLog(void)
        res = PQexec(conn, "IDENTIFY_SYSTEM");
        if (PQresultStatus(res) != PGRES_TUPLES_OK)
        {
-               fprintf(stderr, _("%s: could not identify system: %s\n"),
-                               progname, PQerrorMessage(conn));
+               fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
+                               progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
                disconnect_and_exit(1);
        }
        if (PQntuples(res) != 1 || PQnfields(res) != 3)
        {
-               fprintf(stderr, _("%s: could not identify system, got %d rows and %d fields\n"),
-                               progname, PQntuples(res), PQnfields(res));
+               fprintf(stderr,
+                               _("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d fields\n"),
+                               progname, PQntuples(res), PQnfields(res), 1, 3);
                disconnect_and_exit(1);
        }
        timeline = atoi(PQgetvalue(res, 0, 1));
        if (sscanf(PQgetvalue(res, 0, 2), "%X/%X", &hi, &lo) != 2)
        {
-               fprintf(stderr, _("%s: could not parse log start position from value \"%s\"\n"),
+               fprintf(stderr,
+                               _("%s: could not parse transaction log location \"%s\"\n"),
                                progname, PQgetvalue(res, 0, 2));
                disconnect_and_exit(1);
        }
@@ -266,14 +274,13 @@ StreamLog(void)
         * Start the replication
         */
        if (verbose)
-               fprintf(stderr, _("%s: starting log streaming at %X/%X (timeline %u)\n"),
-                               progname,
-                               (uint32) (startpos >> 32), (uint32) startpos,
+               fprintf(stderr,
+                               _("%s: starting log streaming at %X/%X (timeline %u)\n"),
+                               progname, (uint32) (startpos >> 32), (uint32) startpos,
                                timeline);
 
        ReceiveXlogStream(conn, startpos, timeline, NULL, basedir,
-                                         stop_streaming,
-                                         standby_message_timeout, false);
+                                         stop_streaming, standby_message_timeout, false);
 
        PQfinish(conn);
 }
@@ -301,15 +308,14 @@ main(int argc, char **argv)
                {"host", required_argument, NULL, 'h'},
                {"port", required_argument, NULL, 'p'},
                {"username", required_argument, NULL, 'U'},
-               {"noloop", no_argument, NULL, 'n'},
+               {"no-loop", no_argument, NULL, 'n'},
                {"no-password", no_argument, NULL, 'w'},
                {"password", no_argument, NULL, 'W'},
-               {"statusint", required_argument, NULL, 's'},
+               {"status-interval", required_argument, NULL, 's'},
                {"verbose", no_argument, NULL, 'v'},
                {NULL, 0, NULL, 0}
        };
        int                     c;
-
        int                     option_index;
 
        progname = get_progname(argv[0]);
@@ -322,8 +328,8 @@ main(int argc, char **argv)
                        usage();
                        exit(0);
                }
-               else if (strcmp(argv[1], "-V") == 0
-                                || strcmp(argv[1], "--version") == 0)
+               else if (strcmp(argv[1], "-V") == 0 ||
+                                strcmp(argv[1], "--version") == 0)
                {
                        puts("pg_receivexlog (PostgreSQL) " PG_VERSION);
                        exit(0);
@@ -417,12 +423,13 @@ main(int argc, char **argv)
        {
                StreamLog();
                if (time_to_abort)
-
+               {
                        /*
                         * We've been Ctrl-C'ed. That's not an error, so exit without an
                         * errorcode.
                         */
                        exit(0);
+               }
                else if (noloop)
                {
                        fprintf(stderr, _("%s: disconnected.\n"), progname);
@@ -430,7 +437,8 @@ main(int argc, char **argv)
                }
                else
                {
-                       fprintf(stderr, _("%s: disconnected. Waiting %d seconds to try again\n"),
+                       fprintf(stderr,
+                                       _("%s: disconnected. Waiting %d seconds to try again\n"),
                                        progname, RECONNECT_SLEEP_TIME);
                        pg_usleep(RECONNECT_SLEEP_TIME * 1000000);
                }
index 12b349105578221fe55aac6317d3801d4ec9befb..c91cf1bbe86e074b1c81cfc95430a09cdef82192 100644 (file)
@@ -39,7 +39,7 @@
 #define STREAMING_KEEPALIVE_SIZE (1+sizeof(PrimaryKeepaliveMessage))
 
 /* fd for currently open WAL file */
-static int             walfile = -1;
+static int     walfile = -1;
 
 
 /*
@@ -50,7 +50,8 @@ static int            walfile = -1;
  * The file will be padded to 16Mb with zeroes.
  */
 static int
-open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir, char *namebuf)
+open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir,
+                        char *namebuf)
 {
        int                     f;
        char            fn[MAXPGPATH];
@@ -66,7 +67,8 @@ open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir, char *namebu
        f = open(fn, O_WRONLY | O_CREAT | PG_BINARY, S_IRUSR | S_IWUSR);
        if (f == -1)
        {
-               fprintf(stderr, _("%s: could not open WAL segment %s: %s\n"),
+               fprintf(stderr,
+                               _("%s: could not open transaction log file \"%s\": %s\n"),
                                progname, fn, strerror(errno));
                return -1;
        }
@@ -77,7 +79,8 @@ open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir, char *namebu
         */
        if (fstat(f, &statbuf) != 0)
        {
-               fprintf(stderr, _("%s: could not stat WAL segment %s: %s\n"),
+               fprintf(stderr,
+                               _("%s: could not stat transaction log file \"%s\": %s\n"),
                                progname, fn, strerror(errno));
                close(f);
                return -1;
@@ -86,7 +89,8 @@ open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir, char *namebu
                return f;                               /* File is open and ready to use */
        if (statbuf.st_size != 0)
        {
-               fprintf(stderr, _("%s: WAL segment %s is %d bytes, should be 0 or %d\n"),
+               fprintf(stderr,
+                               _("%s: transaction log file \"%s\" has %d bytes, should be 0 or %d\n"),
                                progname, fn, (int) statbuf.st_size, XLogSegSize);
                close(f);
                return -1;
@@ -98,7 +102,8 @@ open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir, char *namebu
        {
                if (write(f, zerobuf, XLOG_BLCKSZ) != XLOG_BLCKSZ)
                {
-                       fprintf(stderr, _("%s: could not pad WAL segment %s: %s\n"),
+                       fprintf(stderr,
+                                       _("%s: could not pad transaction log file \"%s\": %s\n"),
                                        progname, fn, strerror(errno));
                        free(zerobuf);
                        close(f);
@@ -110,7 +115,8 @@ open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir, char *namebu
 
        if (lseek(f, SEEK_SET, 0) != 0)
        {
-               fprintf(stderr, _("%s: could not seek back to beginning of WAL segment %s: %s\n"),
+               fprintf(stderr,
+                               _("%s: could not seek to beginning of transaction log file \"%s\": %s\n"),
                                progname, fn, strerror(errno));
                close(f);
                return -1;
@@ -119,7 +125,8 @@ open_walfile(XLogRecPtr startpoint, uint32 timeline, char *basedir, char *namebu
 }
 
 /*
- * Close the current WAL file, and rename it to the correct filename if it's complete.
+ * Close the current WAL file, and rename it to the correct filename if it's
+ * complete.
  *
  * If segment_complete is true, rename the current WAL file even if we've not
  * completed writing the whole segment.
@@ -131,21 +138,22 @@ close_walfile(char *basedir, char *walname, bool segment_complete)
 
        if (currpos == -1)
        {
-               fprintf(stderr, _("%s: could not get current position in file %s: %s\n"),
+               fprintf(stderr,
+                        _("%s: could not determine seek position in file \"%s\": %s\n"),
                                progname, walname, strerror(errno));
                return false;
        }
 
        if (fsync(walfile) != 0)
        {
-               fprintf(stderr, _("%s: could not fsync file %s: %s\n"),
+               fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
                                progname, walname, strerror(errno));
                return false;
        }
 
        if (close(walfile) != 0)
        {
-               fprintf(stderr, _("%s: could not close file %s: %s\n"),
+               fprintf(stderr, _("%s: could not close file \"%s\": %s\n"),
                                progname, walname, strerror(errno));
                walfile = -1;
                return false;
@@ -165,13 +173,14 @@ close_walfile(char *basedir, char *walname, bool segment_complete)
                snprintf(newfn, sizeof(newfn), "%s/%s", basedir, walname);
                if (rename(oldfn, newfn) != 0)
                {
-                       fprintf(stderr, _("%s: could not rename file %s: %s\n"),
+                       fprintf(stderr, _("%s: could not rename file \"%s\": %s\n"),
                                        progname, walname, strerror(errno));
                        return false;
                }
        }
        else
-               fprintf(stderr, _("%s: not renaming %s, segment is not complete.\n"),
+               fprintf(stderr,
+                               _("%s: not renaming \"%s\", segment is not complete.\n"),
                                progname, walname);
 
        return true;
@@ -271,7 +280,10 @@ localTimestampDifferenceExceeds(TimestampTz start_time,
  * Note: The log position *must* be at a log segment start!
  */
 bool
-ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysidentifier, char *basedir, stream_stop_callback stream_stop, int standby_message_timeout, bool rename_partial)
+ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
+                                 char *sysidentifier, char *basedir,
+                                 stream_stop_callback stream_stop,
+                                 int standby_message_timeout, bool rename_partial)
 {
        char            query[128];
        char            current_walfile_name[MAXPGPATH];
@@ -286,27 +298,33 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                res = PQexec(conn, "IDENTIFY_SYSTEM");
                if (PQresultStatus(res) != PGRES_TUPLES_OK)
                {
-                       fprintf(stderr, _("%s: could not identify system: %s\n"),
-                                       progname, PQerrorMessage(conn));
+                       fprintf(stderr,
+                                       _("%s: could not send replication command \"%s\": %s"),
+                                       progname, "IDENTIFY_SYSTEM", PQerrorMessage(conn));
                        PQclear(res);
                        return false;
                }
                if (PQnfields(res) != 3 || PQntuples(res) != 1)
                {
-                       fprintf(stderr, _("%s: could not identify system, got %d rows and %d fields\n"),
-                                       progname, PQntuples(res), PQnfields(res));
+                       fprintf(stderr,
+                                       _("%s: could not identify system: got %d rows and %d fields, expected %d rows and %d fields\n"),
+                                       progname, PQntuples(res), PQnfields(res), 1, 3);
                        PQclear(res);
                        return false;
                }
                if (strcmp(sysidentifier, PQgetvalue(res, 0, 0)) != 0)
                {
-                       fprintf(stderr, _("%s: system identifier does not match between base backup and streaming connection\n"), progname);
+                       fprintf(stderr,
+                                       _("%s: system identifier does not match between base backup and streaming connection\n"),
+                                       progname);
                        PQclear(res);
                        return false;
                }
                if (timeline != atoi(PQgetvalue(res, 0, 1)))
                {
-                       fprintf(stderr, _("%s: timeline does not match between base backup and streaming connection\n"), progname);
+                       fprintf(stderr,
+                                       _("%s: timeline does not match between base backup and streaming connection\n"),
+                                       progname);
                        PQclear(res);
                        return false;
                }
@@ -319,8 +337,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
        res = PQexec(conn, query);
        if (PQresultStatus(res) != PGRES_COPY_BOTH)
        {
-               fprintf(stderr, _("%s: could not start replication: %s\n"),
-                               progname, PQresultErrorMessage(res));
+               fprintf(stderr, _("%s: could not send replication command \"%s\": %s"),
+                               progname, "START_REPLICATION", PQresultErrorMessage(res));
                PQclear(res);
                return false;
        }
@@ -348,7 +366,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                 */
                if (stream_stop && stream_stop(blockpos, timeline, false))
                {
-                       if (walfile != -1 && !close_walfile(basedir, current_walfile_name, rename_partial))
+                       if (walfile != -1 && !close_walfile(basedir, current_walfile_name,
+                                                                                               rename_partial))
                                /* Potential error message is written by close_walfile */
                                goto error;
                        return true;
@@ -364,8 +383,9 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                {
                        /* Time to send feedback! */
                        char            replybuf[sizeof(StandbyReplyMessage) + 1];
-                       StandbyReplyMessage *replymsg = (StandbyReplyMessage *) (replybuf + 1);
+                       StandbyReplyMessage *replymsg;
 
+                       replymsg = (StandbyReplyMessage *) (replybuf + 1);
                        replymsg->write = blockpos;
                        replymsg->flush = InvalidXLogRecPtr;
                        replymsg->apply = InvalidXLogRecPtr;
@@ -433,7 +453,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                        /* Else there is actually data on the socket */
                        if (PQconsumeInput(conn) == 0)
                        {
-                               fprintf(stderr, _("%s: could not receive data from WAL stream: %s\n"),
+                               fprintf(stderr,
+                                               _("%s: could not receive data from WAL stream: %s"),
                                                progname, PQerrorMessage(conn));
                                goto error;
                        }
@@ -444,7 +465,7 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                        break;
                if (r == -2)
                {
-                       fprintf(stderr, _("%s: could not read copy data: %s\n"),
+                       fprintf(stderr, _("%s: could not read COPY data: %s"),
                                        progname, PQerrorMessage(conn));
                        goto error;
                }
@@ -456,7 +477,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                         */
                        if (r != STREAMING_KEEPALIVE_SIZE)
                        {
-                               fprintf(stderr, _("%s: keepalive message is incorrect size: %d\n"),
+                               fprintf(stderr,
+                                               _("%s: keepalive message has incorrect size %d\n"),
                                                progname, r);
                                goto error;
                        }
@@ -488,7 +510,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                        /* No file open yet */
                        if (xlogoff != 0)
                        {
-                               fprintf(stderr, _("%s: received xlog record for offset %u with no file open\n"),
+                               fprintf(stderr,
+                                               _("%s: received transaction log record for offset %u with no file open\n"),
                                                progname, xlogoff);
                                goto error;
                        }
@@ -499,7 +522,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                        /* XXX: store seek value don't reseek all the time */
                        if (lseek(walfile, 0, SEEK_CUR) != xlogoff)
                        {
-                               fprintf(stderr, _("%s: got WAL data offset %08x, expected %08x\n"),
+                               fprintf(stderr,
+                                               _("%s: got WAL data offset %08x, expected %08x\n"),
                                                progname, xlogoff, (int) lseek(walfile, 0, SEEK_CUR));
                                goto error;
                        }
@@ -534,10 +558,9 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
                                          copybuf + STREAMING_HEADER_SIZE + bytes_written,
                                          bytes_to_write) != bytes_to_write)
                        {
-                               fprintf(stderr, _("%s: could not write %u bytes to WAL file %s: %s\n"),
-                                               progname,
-                                               bytes_to_write,
-                                               current_walfile_name,
+                               fprintf(stderr,
+                                 _("%s: could not write %u bytes to WAL file \"%s\": %s\n"),
+                                               progname, bytes_to_write, current_walfile_name,
                                                strerror(errno));
                                goto error;
                        }
@@ -581,7 +604,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline, char *sysi
        res = PQgetResult(conn);
        if (PQresultStatus(res) != PGRES_COMMAND_OK)
        {
-               fprintf(stderr, _("%s: unexpected termination of replication stream: %s\n"),
+               fprintf(stderr,
+                               _("%s: unexpected termination of replication stream: %s"),
                                progname, PQresultErrorMessage(res));
                goto error;
        }
index 96311e07b31f4460664982ca5458df9afe54998b..c32c5acb2b9db58a7e0fa14dea0d42017e12058d 100644 (file)
@@ -184,7 +184,8 @@ GetConnection(void)
                tmpparam = PQparameterStatus(tmpconn, "integer_datetimes");
                if (!tmpparam)
                {
-                       fprintf(stderr, _("%s: could not determine server setting for integer_datetimes\n"),
+                       fprintf(stderr,
+                                       _("%s: could not determine server setting for integer_datetimes\n"),
                                        progname);
                        PQfinish(tmpconn);
                        exit(1);
@@ -196,7 +197,8 @@ GetConnection(void)
                if (strcmp(tmpparam, "off") != 0)
 #endif
                {
-                       fprintf(stderr, _("%s: integer_datetimes compile flag does not match server\n"),
+                       fprintf(stderr,
+                        _("%s: integer_datetimes compile flag does not match server\n"),
                                        progname);
                        PQfinish(tmpconn);
                        exit(1);