Re: pgwin32_open returning EINVAL - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: pgwin32_open returning EINVAL
Date
Msg-id 20071129211504.GN9567@alvh.no-ip.org
Whole thread Raw
In response to Re: pgwin32_open returning EINVAL  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pgwin32_open returning EINVAL  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Magnus Hagander <magnus@hagander.net> writes:
> > Tom Lane wrote:
> >> I'm still not convinced what you think the problematic situation is.
> 
> > I believe Alvaros point is that several different GetLastError codes map
> > to the same errno code, making it impossible to see the difference
> > between those errors.
> 
> (1) If we need to know the difference, then we shouldn't be mapping them
> to the same thing.

I totally agree with that, but the problem is the API is not very
flexible in this regard.  We can only use error codes that strerror() is
going to recognize.

A radical idea would be to store the Windows error code from
GetLastError in a new field in ErrorData, and display it in the next
ereport().  Perhaps use a special error callback to add an errcontext in
the possibly problematic cases.

> (2) Do we have any live cases where we must know this?  Much less enough
> cases to justify a global increase in the log chattiness?  It's not like
> we cannot get the information if we really need it.

Yes.  This thread shows the problem:

http://archives.postgresql.org/pgsql-es-ayuda/2007-11/msg00354.php

Basically he is getting this error:

2007-11-16 14:54:16 ERROR:  could not open relation 1663/16403/16487: Invalid argument

and no further indication of what's going on.  I did some searching a
couple of days ago and none of the cases I could find got a resolution.

http://archives.free.net.ph/message/20060930.223306.6ac7d657.en.html
http://www.mydatabasesupport.com/forums/postgresql/314656-general-postgre-crash-currval-problem-help.html

-- 
Alvaro Herrera                        http://www.advogato.org/person/alvherre
"Doing what he did amounts to sticking his fingers under the hood of the
implementation; if he gets his fingers burnt, it's his problem."  (Tom Lane)


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [GENERAL] Empty arrays with ARRAY[]
Next
From: Tom Lane
Date:
Subject: Re: pgwin32_open returning EINVAL