Re: pgwin32_open returning EINVAL

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Trevor Talbot <quension(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Zeugswetter Andreas ADI SD <Andreas(dot)Zeugswetter(at)s-itsolutions(dot)at>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Gregory Stark <stark(at)enterprisedb(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgwin32_open returning EINVAL
Date: 2007-12-20 12:58:14
Message-ID: 20071220125814.GA26753@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 20, 2007 at 04:47:33AM -0800, Trevor Talbot wrote:
> On 12/20/07, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
> > On Thu, Dec 20, 2007 at 04:39:55AM -0800, Trevor Talbot wrote:
> > > On 12/20/07, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>
> > > > ereport(WARNING,
> > > > (errmsg("could not open file \"%s\": %s violation", fileName,
> > > > (GetLastError() ==
> > > > ERROR_SHARING_VIOLATION)?_("sharing"):_("lock")),
> > > > errdetail("Continuing to retry for 30 seconds."),
> > > > errhint("You may have antivirus, backup or similar software
> > > > interfering with the database.")));
>
> > > Without looking myself, is it possible for errhint() or errdetail() to
> > > do something that affects GetLastError()? It's like errno, checking it
> > > very far away from the call site makes me nervous.
>
> > I guess, but it shouldn't matter. We're giong to loop right back up and do a
> > new CreateFile() after this, which will overwrite it again.
>
> I mean for the purposes of the report. I'm worried the message might
> say it's a lock violation when it's really a sharing violation.

Wouldn't we then have the same problem for every place that does a %i and
report GetLastError() or errno? And we have a *lot* of those... I would've
thought the framework thinks of that, but I haven't actually verified that.

If it's a problem, it's trivial to save the value off in a variable, of
course.

//Magnus

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2007-12-20 13:28:30 duplicate columns with COPY
Previous Message Alvaro Herrera 2007-12-20 12:52:43 Re: pgwin32_open returning EINVAL