Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied - Mailing list pgsql-general

From Magnus Hagander
Subject Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied
Date
Msg-id AANLkTil58gAWjbD1aYDxZKDEVYMq_uu9m_mR_Ffj5tu9@mail.gmail.com
Whole thread Raw
In response to Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied  (Craig Ringer <craig@postnewspapers.com.au>)
Responses Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied  ("John T. Dow" <john@johntdow.com>)
List pgsql-general
On Sun, Jun 13, 2010 at 5:11 AM, Craig Ringer
<craig@postnewspapers.com.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/

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Re: Error on Windows server could not open relation base/xxx/xxx Permission denied
Next
From: Andre Lopes
Date:
Subject: How to emulate password generation in PHP with PlpgSQL?