pgsql-4694

Version:

8.3.6

How it is diagnosed:

Source analysis.

Links:

Bug report: http://archives.postgresql.org/pgsql-bugs/2009-03/msg00034.php

Patch:http://archives.postgresql.org/pgsql-committers/2009-04/msg00030.php

Symptom:

postgres fails to start on Windows.

set system variables "path"  add "E:\POSTGRES\PGSQL\BIN;" --uppercase

cmd;

pg_ctl register -N postgres -D "e:\postgres\pgdata"

when I start server , failure

error msg is :

LOG:  could not open directory "/share/timezone": No such file or directory
FATAL:  could not select a suitable default timezone
DETAIL:  It appears that your GMT time zone uses leap seconds. PostgreSQL
does not support leap seconds.

if I change  system variables "path" into lowercase, success.

Root cause:
On Windows OS, postgres should be case-insensitive when handling path name. However, it handles path name case-sensitively.

*** pgsql/src/port/path.c        2009/01/01 17:24:04        1.76
--- pgsql/src/port/path.c        2009/04/03 11:52:08        1.77
***************

*************** dir_strcmp(const char *s1, const char *s
*** 427,433 ****
--- 427,438 ----
 {
         while (*s1 && *s2)
         {
+ #ifndef WIN32
                 if (*s1 != *s2 &&
+ #else
+                         /* On windows, paths are case-insensitive */
+                 if (pg_tolower(*s1) != pg_tolower(*s2) &&
+ #endif
                         !(IS_DIR_SEP(*s1) && IS_DIR_SEP(*s2)))
                         return (int) *s1 - (int) *s2;
                 s1++, s2++;

------------ Where the error message was printed: --------

 pdir = AllocateDir(pkglib_path);

   1087     if (pdir == NULL)

   1088         ereport(ERROR,

   1089                 (errcode_for_file_access(),

   1090                  errmsg("could not open directory \"%s\": %m",

   1091                         pkglib_path),

   1092                  errhint("This may indicate an incomplete PostgreSQL installation, or that the file \        "%s\" has been moved away from its proper location.",

   1093                          my_exec_path)));

Where AllocateDir is wrapper for ‘opendir’.

Failure type:

Reject valid input, early termination

Is there any log message?:

Yes.

Can ErrLog automatically insert a log message?

Yes. library return value: