Index: src//backend/commands/variable.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/commands/variable.c,v retrieving revision 1.73 diff -c -r1.73 variable.c *** src//backend/commands/variable.c 2003/02/01 18:31:28 1.73 --- src//backend/commands/variable.c 2003/02/24 21:29:44 *************** *** 243,252 **** const char * assign_timezone(const char *value, bool doit, bool interactive) { ! char *result; ! char *endptr; double hours; /* * Check for INTERVAL 'foo' */ --- 243,257 ---- const char * assign_timezone(const char *value, bool doit, bool interactive) { ! char *result; ! char *endptr; ! char tztmp[sizeof(tzbuf)]; ! char *lp; ! const char *cp; double hours; + int tzval,i; + /* * Check for INTERVAL 'foo' */ *************** *** 337,348 **** else { /* ! * Otherwise assume it is a timezone name. * ! * XXX unfortunately we have no reasonable way to check whether a ! * timezone name is good, so we have to just assume that it ! * is. */ if (doit) { strcpy(tzbuf, "TZ="); --- 342,360 ---- else { /* ! * Otherwise assume it is a timezone name. ! * Try tzset() first. If that fails, see if our internal ! * table of timezone names, can handle it. * ! * XXX unfortunately we have only an approximate way to check ! * whether a timezone name is good: if the value of TZ is returned ! * as the canonical tzname, there is no daylight savings time ! * (flag or canonical second name) _and_ the offset is GMT, ! * tzset() punted, i.e., returned all default values. ! * If that happens, try the internal table - if _that_ fails, ! * throw a notice. rjr 2003/02/23 */ + if (doit) { strcpy(tzbuf, "TZ="); *************** *** 351,356 **** --- 363,392 ---- elog(LOG, "assign_timezone: putenv failed"); tzset(); HasCTZSet = false; + if (timezone == 0.0 && strcmp(value,tzname[0]) == 0 && + daylight == 0 && strcmp("",tzname[1]) == 0) + { + cp=value; + lp=tztmp; + *lp++ = tolower((unsigned char) *cp++); + for (i = 0; (i < sizeof(tztmp)) && *cp; i++) + *lp++ = tolower((unsigned char) *cp++); + /* XXX DecodePosixTimezone seems to not handle + * a three character string - there's a fencepost somewhere */ + *lp++ = ' '; + *lp = '\0'; + tzval=0; + if (DecodePosixTimezone(tztmp, &tzval) == 0) + { + CTimeZone = tzval; + HasCTZSet = true; + strncpy(tzbuf,value, sizeof(tzbuf) - 1); + } + else + { + elog(NOTICE, "assign_timezone: unusual spelling of GMT: %s", value); + } + } } } } Index: src//backend/utils/adt/datetime.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/adt/datetime.c,v retrieving revision 1.102 diff -c -r1.102 datetime.c *** src//backend/utils/adt/datetime.c 2003/02/22 05:57:44 1.102 --- src//backend/utils/adt/datetime.c 2003/02/24 21:29:45 *************** *** 33,42 **** struct tm * tm, fsec_t *fsec, int *is2digits); static int DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, fsec_t *fsec); ! static int DecodeTimezone(char *str, int *tzp); static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel); static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm); - static int DecodePosixTimezone(char *str, int *val); static void TrimTrailingZeros(char *str); --- 33,41 ---- struct tm * tm, fsec_t *fsec, int *is2digits); static int DecodeTime(char *str, int fmask, int *tmask, struct tm * tm, fsec_t *fsec); ! static int DecodeTimezone(char *str, int *tzp); static datetkn *datebsearch(char *key, datetkn *base, unsigned int nel); static int DecodeDate(char *str, int fmask, int *tmask, struct tm * tm); static void TrimTrailingZeros(char *str); *************** *** 2595,2601 **** * PST+h * - thomas 2000-03-15 */ ! static int DecodePosixTimezone(char *str, int *tzp) { int val, --- 2594,2600 ---- * PST+h * - thomas 2000-03-15 */ ! int DecodePosixTimezone(char *str, int *tzp) { int val, Index: src//include/utils/datetime.h =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/include/utils/datetime.h,v retrieving revision 1.36 diff -c -r1.36 datetime.h *** src//include/utils/datetime.h 2003/02/20 05:24:55 1.36 --- src//include/utils/datetime.h 2003/02/24 21:29:45 *************** *** 280,285 **** --- 280,287 ---- int nf, int *dtype, struct tm * tm, fsec_t *fsec); + extern int DecodePosixTimezone(char *str, int *tzp); + extern int DetermineLocalTimeZone(struct tm * tm); extern int EncodeDateOnly(struct tm * tm, int style, char *str);