Fix for pg_update on win32 - Mailing list pgsql-hackers

From Bruce Momjian
Subject Fix for pg_update on win32
Date
Msg-id 201107300556.p6U5udi22629@momjian.us
Whole thread Raw
List pgsql-hackers
Based on EnterpriseDB testing, I have applied the attached patch to fix
a pg_upgrade bug on Win32 on 9.1 and 9.2.  The problem is that on Win32
you can't stat() a directory with a trailing slash --- this is already
mentioned in our src/port/path.c.  The patch removes a lone trailing
slash.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/contrib/pg_upgrade/exec.c b/contrib/pg_upgrade/exec.c
new file mode 100644
index ef21899..b632584
*** a/contrib/pg_upgrade/exec.c
--- b/contrib/pg_upgrade/exec.c
*************** check_data_dir(const char *pg_data)
*** 168,174 ****
      {
          struct stat statBuf;

!         snprintf(subDirName, sizeof(subDirName), "%s/%s", pg_data,
                   requiredSubdirs[subdirnum]);

          if (stat(subDirName, &statBuf) != 0)
--- 168,176 ----
      {
          struct stat statBuf;

!         snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
!             /* Win32 can't stat() a directory with a trailing slash. */
!                  *requiredSubdirs[subdirnum] ? "/" : "",
                   requiredSubdirs[subdirnum]);

          if (stat(subDirName, &statBuf) != 0)

pgsql-hackers by date:

Previous
From: Nikhil Sontakke
Date:
Subject: Re: Check constraints on partition parents only?
Next
From: Tom Lane
Date:
Subject: Re: pgbench internal contention