validate_int_timestamps.patch
text/x-patch
Filename: validate_int_timestamps.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/bin/pg_basebackup/streamutil.c | 24 | 0 |
diff --git a/src/bin/pg_basebackup/streamutil.c b/src/bin/pg_basebackup/streamutil.c
index b12932f..3a3217d 100644
--- a/src/bin/pg_basebackup/streamutil.c
+++ b/src/bin/pg_basebackup/streamutil.c
@@ -75,6 +75,7 @@ GetConnection(void)
const char **keywords;
const char **values;
char *password = NULL;
+ char *tmpparam;
if (dbhost)
argcount++;
@@ -157,6 +158,29 @@ GetConnection(void)
free(values);
free(keywords);
+ /*
+ * Ensure we have the same value of integer timestamps as the
+ * server we are connecting to.
+ */
+ tmpparam = PQparameterStatus(tmpconn, "integer_datetimes");
+ if (!tmpparam)
+ {
+ fprintf(stderr, _("%s: could not determine server setting for integer_datetimes\n"),
+ progname);
+ exit(1);
+ }
+
+#ifdef HAVE_INT64_TIMESTAMP
+ if (strcmp(tmpparam, "on") != 0)
+#else
+ if (strcmp(tmpparam, "off") != 0)
+#endif
+ {
+ fprintf(stderr, _("%s: integer_datetimes compile flag mismatch with server\n"),
+ progname);
+ exit(1);
+ }
+
/* Store the password for next run */
if (password)
dbpassword = password;