Skip to content

Commit 304aa33

Browse files
committed
Prevent pg_basebackup when integer_datetimes flag doesn't match.
Magnus Hagander, reviewed by Fujii Masao, with slight wording changes by me.
1 parent 219c024 commit 304aa33

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/bin/pg_basebackup/streamutil.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ GetConnection(void)
7575
const char **keywords;
7676
const char **values;
7777
char *password = NULL;
78+
const char *tmpparam;
7879

7980
if (dbhost)
8081
argcount++;
@@ -157,6 +158,29 @@ GetConnection(void)
157158
free(values);
158159
free(keywords);
159160

161+
/*
162+
* Ensure we have the same value of integer timestamps as the
163+
* server we are connecting to.
164+
*/
165+
tmpparam = PQparameterStatus(tmpconn, "integer_datetimes");
166+
if (!tmpparam)
167+
{
168+
fprintf(stderr, _("%s: could not determine server setting for integer_datetimes\n"),
169+
progname);
170+
exit(1);
171+
}
172+
173+
#ifdef HAVE_INT64_TIMESTAMP
174+
if (strcmp(tmpparam, "on") != 0)
175+
#else
176+
if (strcmp(tmpparam, "off") != 0)
177+
#endif
178+
{
179+
fprintf(stderr, _("%s: integer_datetimes compile flag does not match server\n"),
180+
progname);
181+
exit(1);
182+
}
183+
160184
/* Store the password for next run */
161185
if (password)
162186
dbpassword = password;

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