Re: --enable-thread-safety on Win32

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dave Page <dpage(at)vale-housing(dot)co(dot)uk>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: --enable-thread-safety on Win32
Date: 2005-08-13 01:35:19
Message-ID: 200508130135.j7D1ZJV17021@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk> writes:
> > However.... In all but one place in libpq, we don't use errno anyway
> > (actually 2, but one is a bug anyway) because we use GetLastError()
> > instead (which tested thread safe as well FWIW). The only place it's
> > used is PQoidValue():
>
> > result = strtoul(res->cmdStatus + 7, &endptr, 10);
>
> > if (!endptr || (*endptr != ' ' && *endptr != '\0') || errno ==
> > ERANGE)
> > return InvalidOid;
> > else
> > return (Oid) result;
>
> > We don't believe strtoul() works with GetLastError() unfortunately. One
> > (hackish) solution would be to check that it doesn't return 0 or
> > ULONG_MAX.
>
> I'm not sure why we bother with an overflow check there at all. It'd be
> worth checking that there is a digit at cmdStatus + 7, but as long as
> there is one, it's difficult to see why an overflow check is needed.
>
> The only justification that comes to mind is that if someday there are
> versions of Postgres that have 64-bit OIDs, you could get an overflow
> here if you had a 32-bit-OID libpq talking to a 64-bit server. However,
> I don't see a particularly good reason to return InvalidOid instead of
> an overflowed value anyway in that situation. For PQoidValue,
> InvalidOid is supposed to mean "there is no OID in this command status"
> not "there is an OID but I cannot represent it".

I disabled the check on Win32, and added a comment explaining why. We
could disable it just when we use thread-safety, but changing the
behavior for threading didn't seems wise.

--
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

Attachment Content-Type Size
unknown_filename text/plain 966 bytes

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-08-13 01:53:25 Re: PL/pgSQL: SELECT INTO EXACT
Previous Message Marc G. Fournier 2005-08-13 01:34:06 Re: DROP OWNED BY