On Thursday, May 10, 2012, Fujii Masao wrote: > On Thu, May 10, 2012 at 11:51 PM, Magnus Hagander > <mag...@hagander.net<javascript:;>> > wrote: > > And taking this a step further - we *already* send these GUCs. > > Previous references to us not doing that were incorrect :-) > > > > So this should be a much easier fix than we thought. And can be done > > entirely in pg_basebackup, meaning we don't need to worry about > > beta... > > Sounds good! > > Should we go down the easy way and just reject connections when the flag is mismatching between the client and the server (trivial to do - see the attached patch)? Or should we try to implement both floating point and integer in pg_basebackup, and make it work in either case? (We'd still have to reject it if pg_basebackup was compiled without support for int64 at all, of course, but the large majority of cases will have integer timestamps these days, but could be made to support both integer and float for the trivial operations that pg_basebackup actually does).
How common *is* it to have a build that doesn't have integer timestamps these days? Does any of the binary builds do that at all, for example? If it's uncommon enough, I think we should just go with the easy way out... //Magnus -- Magnus Hagander Me: http://www.hagander.net/ Work: http://www.redpill-linpro.com/
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;
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers