diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2014-10-26 20:59:21 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2014-10-26 20:59:21 -0400 |
commit | f455fcfdb8ca3b67373223a4e15648c35e2592a9 (patch) | |
tree | 0a303e28d2b17ed0633eea969f42cc91ebaa14be /src/bin/pg_dump/dumputils.h | |
parent | 9711fa06081da230e62fa52147c49ccf7b9ccbe2 (diff) | |
download | postgresql-f455fcfdb8ca3b67373223a4e15648c35e2592a9.tar.gz postgresql-f455fcfdb8ca3b67373223a4e15648c35e2592a9.zip |
Avoid unportable strftime() behavior in pg_dump/pg_dumpall.
Commit ad5d46a4494b0b480a3af246bb4227d9bdadca37 thought that we could
get around the known portability issues of strftime's %Z specifier by
using %z instead. However, that idea seems to have been innocent of
any actual research, as it certainly missed the facts that
(1) %z is not portable to pre-C99 systems, and
(2) %z doesn't actually act differently from %Z on Windows anyway.
Per failures on buildfarm member hamerkop.
While at it, centralize the code defining what strftime format we
want to use in pg_dump; three copies of that string seems a bit much.
Diffstat (limited to 'src/bin/pg_dump/dumputils.h')
-rw-r--r-- | src/bin/pg_dump/dumputils.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/bin/pg_dump/dumputils.h b/src/bin/pg_dump/dumputils.h index 688e9ca6b82..aaf40748524 100644 --- a/src/bin/pg_dump/dumputils.h +++ b/src/bin/pg_dump/dumputils.h @@ -49,6 +49,23 @@ typedef struct SimpleStringList #define atooid(x) ((Oid) strtoul((x), NULL, 10)) +/* + * Preferred strftime(3) format specifier for printing timestamps in pg_dump + * and friends. + * + * We don't print the timezone on Windows, because the names are long and + * localized, which means they may contain characters in various random + * encodings; this has been seen to cause encoding errors when reading the + * dump script. Think not to get around that by using %z, because + * (1) %z is not portable to pre-C99 systems, and + * (2) %z doesn't actually act differently from %Z on Windows anyway. + */ +#ifndef WIN32 +#define PGDUMP_STRFTIME_FMT "%Y-%m-%d %H:%M:%S %Z" +#else +#define PGDUMP_STRFTIME_FMT "%Y-%m-%d %H:%M:%S" +#endif + extern int quote_all_identifiers; extern PQExpBuffer (*getLocalPQExpBuffer) (void); |