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

Commit6ead782

Browse files
committed
Improve message style for messages associated with not being able to
identify the system time zone setting. Per recent discussion.
1 parent95eaea4 commit6ead782

File tree

1 file changed

+42
-29
lines changed

1 file changed

+42
-29
lines changed

‎src/timezone/pgtz.c

Lines changed: 42 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.71 2010/04/09 11:49:51 mha Exp $
9+
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.72 2010/04/15 18:46:45 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -498,8 +498,10 @@ identify_system_timezone(void)
498498
if (std_zone_name[0]=='\0')
499499
{
500500
ereport(LOG,
501-
(errmsg("could not determine system time zone, defaulting to \"%s\"","GMT"),
502-
errhint("You can specify the correct timezone in postgresql.conf.")));
501+
(errmsg("could not determine system time zone"),
502+
errdetail("The PostgreSQL time zone will be set to \"%s\".",
503+
"GMT"),
504+
errhint("You can specify the correct timezone in postgresql.conf.")));
503505
returnNULL;/* go to GMT */
504506
}
505507

@@ -533,9 +535,10 @@ identify_system_timezone(void)
533535
(-std_ofs>0) ?"+" :"",-std_ofs /3600);
534536

535537
ereport(LOG,
536-
(errmsg("could not recognize system timezone, defaulting to \"%s\"",
537-
resultbuf),
538-
errhint("You can specify the correct timezone in postgresql.conf.")));
538+
(errmsg("could not recognize system time zone"),
539+
errdetail("The PostgreSQL time zone will be set to \"%s\".",
540+
resultbuf),
541+
errhint("You can specify the correct timezone in postgresql.conf.")));
539542
returnresultbuf;
540543
}
541544

@@ -1076,9 +1079,12 @@ identify_system_timezone(void)
10761079

10771080
if (!tm)
10781081
{
1079-
ereport(WARNING,
1080-
(errmsg_internal("could not determine current date/time: localtime failed")));
1081-
returnNULL;
1082+
ereport(LOG,
1083+
(errmsg("could not identify system time zone: localtime() failed"),
1084+
errdetail("The PostgreSQL time zone will be set to \"%s\".",
1085+
"GMT"),
1086+
errhint("You can specify the correct timezone in postgresql.conf.")));
1087+
returnNULL;/* go to GMT */
10821088
}
10831089

10841090
memset(tzname,0,sizeof(tzname));
@@ -1089,7 +1095,7 @@ identify_system_timezone(void)
10891095
if (strcmp(tzname,win32_tzmap[i].stdname)==0||
10901096
strcmp(tzname,win32_tzmap[i].dstname)==0)
10911097
{
1092-
elog(DEBUG4,"TZ \"%s\" matchesWindows timezone \"%s\"",
1098+
elog(DEBUG4,"TZ \"%s\" matchessystem time zone \"%s\"",
10931099
win32_tzmap[i].pgtzname,tzname);
10941100
returnwin32_tzmap[i].pgtzname;
10951101
}
@@ -1107,9 +1113,13 @@ identify_system_timezone(void)
11071113
KEY_READ,
11081114
&rootKey)!=ERROR_SUCCESS)
11091115
{
1110-
ereport(WARNING,
1111-
(errmsg_internal("could not open registry key to identify Windows timezone: %i", (int)GetLastError())));
1112-
returnNULL;
1116+
ereport(LOG,
1117+
(errmsg("could not open registry key to identify system time zone: %i",
1118+
(int)GetLastError()),
1119+
errdetail("The PostgreSQL time zone will be set to \"%s\".",
1120+
"GMT"),
1121+
errhint("You can specify the correct timezone in postgresql.conf.")));
1122+
returnNULL;/* go to GMT */
11131123
}
11141124

11151125
for (idx=0;;idx++)
@@ -1134,24 +1144,24 @@ identify_system_timezone(void)
11341144
{
11351145
if (r==ERROR_NO_MORE_ITEMS)
11361146
break;
1137-
ereport(WARNING,
1138-
(errmsg_internal("could not enumerate registry subkeys to identifyWindows timezone: %i", (int)r)));
1147+
ereport(LOG,
1148+
(errmsg_internal("could not enumerate registry subkeys to identifysystem time zone: %i", (int)r)));
11391149
break;
11401150
}
11411151

11421152
if ((r=RegOpenKeyEx(rootKey,keyname,0,KEY_READ,&key))!=ERROR_SUCCESS)
11431153
{
1144-
ereport(WARNING,
1145-
(errmsg_internal("could not open registry subkey to identifyWindows timezone: %i", (int)r)));
1154+
ereport(LOG,
1155+
(errmsg_internal("could not open registry subkey to identifysystem time zone: %i", (int)r)));
11461156
break;
11471157
}
11481158

11491159
memset(zonename,0,sizeof(zonename));
11501160
namesize=sizeof(zonename);
11511161
if ((r=RegQueryValueEx(key,"Std",NULL,NULL,zonename,&namesize))!=ERROR_SUCCESS)
11521162
{
1153-
ereport(WARNING,
1154-
(errmsg_internal("could not query value for'std' to identifyWindows timezone \"%s\": %i",
1163+
ereport(LOG,
1164+
(errmsg_internal("could not query value forkey \"std\" to identifysystem time zone \"%s\": %i",
11551165
keyname, (int)r)));
11561166
RegCloseKey(key);
11571167
continue;/* Proceed to look at the next timezone */
@@ -1167,8 +1177,8 @@ identify_system_timezone(void)
11671177
namesize=sizeof(zonename);
11681178
if ((r=RegQueryValueEx(key,"Dlt",NULL,NULL,zonename,&namesize))!=ERROR_SUCCESS)
11691179
{
1170-
ereport(WARNING,
1171-
(errmsg_internal("could not query value for'dlt' to identifyWindows timezone \"%s\": %i",
1180+
ereport(LOG,
1181+
(errmsg_internal("could not query value forkey \"dlt\" to identifysystem time zone \"%s\": %i",
11721182
keyname, (int)r)));
11731183
RegCloseKey(key);
11741184
continue;/* Proceed to look at the next timezone */
@@ -1194,17 +1204,20 @@ identify_system_timezone(void)
11941204
if (strcmp(localtzname,win32_tzmap[i].stdname)==0||
11951205
strcmp(localtzname,win32_tzmap[i].dstname)==0)
11961206
{
1197-
elog(DEBUG4,"TZ \"%s\" matches localizedWindows timezone \"%s\" (\"%s\")",
1207+
elog(DEBUG4,"TZ \"%s\" matches localizedsystem time zone \"%s\" (\"%s\")",
11981208
win32_tzmap[i].pgtzname,tzname,localtzname);
11991209
returnwin32_tzmap[i].pgtzname;
12001210
}
12011211
}
12021212
}
12031213

1204-
ereport(WARNING,
1205-
(errmsg("could not find a match for Windows timezone \"%s\"",
1206-
tzname)));
1207-
returnNULL;
1214+
ereport(LOG,
1215+
(errmsg("could not find a match for system time zone \"%s\"",
1216+
tzname),
1217+
errdetail("The PostgreSQL time zone will be set to \"%s\".",
1218+
"GMT"),
1219+
errhint("You can specify the correct timezone in postgresql.conf.")));
1220+
returnNULL;/* go to GMT */
12081221
}
12091222
#endif/* WIN32 */
12101223

@@ -1390,7 +1403,7 @@ select_default_timezone(void)
13901403
returndef_tz;
13911404

13921405
ereport(FATAL,
1393-
(errmsg("could not select a suitable defaulttimezone"),
1406+
(errmsg("could not select a suitable defaulttime zone"),
13941407
errdetail("It appears that your GMT time zone uses leap seconds. PostgreSQL does not support leap seconds.")));
13951408
returnNULL;/* keep compiler quiet */
13961409
}
@@ -1414,7 +1427,7 @@ pg_timezone_pre_initialize(void)
14141427
* seems OK to just use the "lastditch" case provided by tzparse().
14151428
*/
14161429
if (tzparse("GMT",&gmt_timezone_data.state, TRUE)!=0)
1417-
elog(FATAL,"could not initialize GMTtimezone");
1430+
elog(FATAL,"could not initialize GMTtime zone");
14181431
strcpy(gmt_timezone_data.TZname,"GMT");
14191432
gmt_timezone=&gmt_timezone_data;
14201433
}
@@ -1541,7 +1554,7 @@ pg_tzenumerate_next(pg_tzenum *dir)
15411554
/* Step into the subdirectory */
15421555
if (dir->depth >=MAX_TZDIR_DEPTH-1)
15431556
ereport(ERROR,
1544-
(errmsg("timezone directory stack overflow")));
1557+
(errmsg_internal("timezone directory stack overflow")));
15451558
dir->depth++;
15461559
dir->dirname[dir->depth]=pstrdup(fullname);
15471560
dir->dirdesc[dir->depth]=AllocateDir(fullname);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp