Re: FW: [JDBC] BIGINT vs Java's long

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Dave Cramer <dave(at)fastcrypt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: FW: [JDBC] BIGINT vs Java's long
Date: 2001-08-07 20:10:20
Message-ID: Pine.BSF.4.21.0108071307550.35245-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 7 Aug 2001, Tom Lane wrote:

> Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> writes:
> > I don't think my patch against recent sources would apply cleanly to
> > older ones, and I didn't run the regression against it, but it seemed
> > to work, and is only a two line change in current source.
>
> This patch needs more work. You are assuming that integer division on
> negative numbers works the same everywhere, which it most definitely
> does not (the direction of truncation was unspecified until C99).
> The overflow check will fail on platforms where negative results
> truncate towards minus infinity. So we need a different way of checking
> for overflow.
>
> Right off the bat I'm not coming up with an implementation that's both
> portable and able to accept INT64_MIN, but this has got to be a solved
> problem. Look around, maybe in the GNU or BSD C libraries...

Actually, that wasn't a suggested patch for real inclusion (I should have
mentioned that) but instead for the user in question to try. I'll look
and get something complete for this. :)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fernando Nasser 2001-08-07 20:24:08 Re: OID wraparound: summary and proposal
Previous Message Tom Lane 2001-08-07 19:44:03 Re: FW: [JDBC] BIGINT vs Java's long