mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Suppress timezone (%Z) part of timestamp display when running on Windows,
because on that platform strftime produces localized zone names in varying encodings. Even though it's only in a comment, this can cause encoding errors when reloading the dump script. Per suggestion from Andreas Seltenreich. Also, suppress %Z on Windows in the %s escape of log_line_prefix ... not sure why this one is different from the other two, but it shouldn't be.
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.137 2006/10/14 23:07:22 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.138 2006/11/21 22:19:46 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2780,6 +2780,18 @@ dumpTimestamp(ArchiveHandle *AH, const char *msg, time_t tim)
|
||||
{
|
||||
char buf[256];
|
||||
|
||||
if (strftime(buf, 256, "%Y-%m-%d %H:%M:%S %Z", localtime(&tim)) != 0)
|
||||
/*
|
||||
* We don't print the timezone on Win32, 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.
|
||||
*/
|
||||
if (strftime(buf, sizeof(buf),
|
||||
#ifndef WIN32
|
||||
"%Y-%m-%d %H:%M:%S %Z",
|
||||
#else
|
||||
"%Y-%m-%d %H:%M:%S",
|
||||
#endif
|
||||
localtime(&tim)) != 0)
|
||||
ahprintf(AH, "-- %s %s\n\n", msg, buf);
|
||||
}
|
||||
|
Reference in New Issue
Block a user