Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad5d46a

Browse files
committed
Report timezone offset in pg_dump/pg_dumpall
Use consistent format for all such displays.Report by Gavin Flower
1 parenta74a4aa commitad5d46a

File tree

2 files changed

+8
-29
lines changed

2 files changed

+8
-29
lines changed

‎src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -964,12 +964,15 @@ PrintTOCSummary(Archive *AHX, RestoreOptions *ropt)
964964
teSectioncurSection;
965965
OutputContextsav;
966966
constchar*fmtName;
967+
structtm*tm=localtime(&AH->createDate);
968+
charstamp_str[64];
967969

968970
sav=SaveOutput(AH);
969971
if (ropt->filename)
970972
SetOutput(AH,ropt->filename,0/* no compression */ );
971973

972-
ahprintf(AH,";\n; Archive created at %s",ctime(&AH->createDate));
974+
strftime(stamp_str,sizeof(stamp_str),"%Y-%m-%d %H:%M:%S %z",tm);
975+
ahprintf(AH,";\n; Archive created at %s\n",stamp_str);
973976
ahprintf(AH,"; dbname: %s\n; TOC Entries: %d\n; Compression: %d\n",
974977
AH->archdbname,AH->tocCount,AH->compression);
975978

@@ -3455,21 +3458,9 @@ checkSeek(FILE *fp)
34553458
staticvoid
34563459
dumpTimestamp(ArchiveHandle*AH,constchar*msg,time_ttim)
34573460
{
3458-
charbuf[256];
3461+
charbuf[64];
34593462

3460-
/*
3461-
* We don't print the timezone on Win32, because the names are long and
3462-
* localized, which means they may contain characters in various random
3463-
* encodings; this has been seen to cause encoding errors when reading the
3464-
* dump script.
3465-
*/
3466-
if (strftime(buf,sizeof(buf),
3467-
#ifndefWIN32
3468-
"%Y-%m-%d %H:%M:%S %Z",
3469-
#else
3470-
"%Y-%m-%d %H:%M:%S",
3471-
#endif
3472-
localtime(&tim))!=0)
3463+
if (strftime(buf,sizeof(buf),"%Y-%m-%d %H:%M:%S %z",localtime(&tim))!=0)
34733464
ahprintf(AH,"-- %s %s\n\n",msg,buf);
34743465
}
34753466

‎src/bin/pg_dump/pg_dumpall.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2039,22 +2039,10 @@ executeCommand(PGconn *conn, const char *query)
20392039
staticvoid
20402040
dumpTimestamp(char*msg)
20412041
{
2042-
charbuf[256];
2042+
charbuf[64];
20432043
time_tnow=time(NULL);
20442044

2045-
/*
2046-
* We don't print the timezone on Win32, because the names are long and
2047-
* localized, which means they may contain characters in various random
2048-
* encodings; this has been seen to cause encoding errors when reading the
2049-
* dump script.
2050-
*/
2051-
if (strftime(buf,sizeof(buf),
2052-
#ifndefWIN32
2053-
"%Y-%m-%d %H:%M:%S %Z",
2054-
#else
2055-
"%Y-%m-%d %H:%M:%S",
2056-
#endif
2057-
localtime(&now))!=0)
2045+
if (strftime(buf,sizeof(buf),"%Y-%m-%d %H:%M:%S %z",localtime(&now))!=0)
20582046
fprintf(OPF,"-- %s %s\n\n",msg,buf);
20592047
}
20602048

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp