Re: REPOST: InitDB Failure on install

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Magnus Hagander <mha(at)sollentuna(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Merlin Moncure <merlin(dot)moncure(at)rcsonline(dot)com>, pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: REPOST: InitDB Failure on install
Date: 2004-08-19 02:35:01
Message-ID: 200408190235.i7J2Z1g10817@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers-win32


Added to open items:

o improve ereport %m error messages

---------------------------------------------------------------------------

Magnus Hagander wrote:
> >>>> (BTW, there was some discussion around this point while
> >you were gone.
> >>>> Dunno if you've caught up on the list traffic yet.)
> >
> >> Ok. I think I'm caught up now, and I don't find anything directly
> >> related to this. Could be because there was so much mail
> >that I skimmed
> >> some of it a bit too quickly... Could you provide me with a pointer?
> >
> >It took some digging, but here is the thread I had in mind:
> >http://archives.postgresql.org/pgsql-hackers-win32/2004-08/msg00047.php
> >http://archives.postgresql.org/pgsql-hackers-win32/2004-08/msg00050.php
> >
> >Life does get simpler if we can just do "errno = GetLastError()" but
> >I strongly suspect we're gonna end up wanting to do some mapping.
>
> Arrgh. I did see that one, just didn't connect. I guess the brain gets
> mushy after about 2500 mails.. Sorry about that one.
>
>
> Looking around a bit on the net, I see tons and tons of examples of
> people just doing the "errno=GetLastError()" codepath. And I find no
> evidence anywhere that this should not be safe. For winsock, look at for
> example
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock
> /winsock/error_codes_errno_h_errno_and_wsagetlasterror_2.asp which
> states "For compatibility with BSD, an application may choose to include
> a line of the form: #define errno WSAGetLastError". And
> WSAGetLastError() is equivalent to GetLastError() in any windows these
> days.
>
> Based on this, I think we're quite safe doing errno=GetLastError() in
> any places where we need it.
>
> What we might need to do is change the useful_strerror() function to use
> the FormatMessage function for all messages on win32, and not as now is
> done just for winsock functions. I'm not 100% sure this is needed - it's
> possible it handles all the standard messages and just not winsock. But
> it should not report *incorrect* error messages, it would just not know
> the text for the error message.
>
>
> In order to be future safe we ight want to do something like put a macro
> in win32.h doing
> #define Win32ErrorToErrno(i) i
> and then use
> errno=Win32ErrorToErrno(GetLastError())
>
> In case we ever need a mapping, we can just change that macro into a
> function call, without needing to revisit all the code. Not sure if it's
> worth it, though?
>
> //Magnus
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Robert Treat 2004-08-19 04:18:32 Re: tablespace and sequences?
Previous Message Bruce Momjian 2004-08-19 01:39:27 Re: tablespace and sequences?