Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: "adrian(dot)klaver" <adrian(dot)klaver(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>, "John T(dot) Dow" <john(at)johntdow(dot)com>
Subject: Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied
Date: 2010-06-13 09:51:45
Message-ID: AANLkTil58gAWjbD1aYDxZKDEVYMq_uu9m_mR_Ffj5tu9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Jun 13, 2010 at 5:11 AM, Craig Ringer
<craig(at)postnewspapers(dot)com(dot)au> wrote:
> On 13/06/10 02:34, Adrian Klaver wrote:
>
>>> Question: Is it possible that there's corruption in the database which is
>>> being incorrectly reported as "Permission denied"?
>
> It's certainly not impossible. It'd really help if Pg would print more
> details from Windows' error reporting - GetLastError() etc - in cases
> like this. In fact, some searching reveals complaints about just that as
> far back as mid-2008 related to the exact error you're encountering.

It does if you enable debug logging. DEBUG5 is required from what I
can tell (see src/port/win32error.c, function _dosmaperr(), which is
called from pgwin32_open()).

In a lot of cases it maps straight over, but in the cases where we
have to map to an errno value and use that, there can be more than
one. In the case of access denied, it can be:
ERROR_ACCESS_DENIED
ERROR_CURRENT_DIRECTORY
ERROR_LOCK_VIOLATION
ERROR_SHARING_VIOLATION (but this is taken care of already in pgwin32_open)
ERROR_NETWORK_ACCESS_DENIED
ERROR_CANNOT_MAKE
ERROR_FAIL_I24
ERROR_DRIVE_LOCKED
ERROR_SEEK_ON_DEVICE
ERROR_NOT_LOCKED
ERROR_LOCK_FAILED

Most of these can't (shouldn't be possible at least) appear when we're
opening a file for reading. But it'd be interesting to know what they
were.

So it'd be interesting to see the output of this at DEBUG5 (there
should be a line saying "mapped win32 error code <n> to <n>" showing
up - there will be *tons* of other logging output of course)

--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andre Lopes 2010-06-13 12:45:08 How to emulate password generation in PHP with PlpgSQL?
Previous Message Craig Ringer 2010-06-13 03:11:25 Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied