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

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Dave Cramer <dave(at)fastcrypt(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: FW: [JDBC] BIGINT vs Java's long
Date: 2001-08-07 18:40:07
Message-ID: Pine.BSF.4.21.0108071122390.34686-200000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On Tue, 7 Aug 2001, Dave Cramer wrote:

> This came into the jdbc list
>
> Apparently bigint is not really 8 bytes???
>
> I test this out with psql
>
> test=# create table testbigint (id serial, fp0 int8);
> NOTICE: CREATE TABLE will create implicit sequence 'testbigint_id_seq'
> for SERIAL column 'testbigint.id'
> NOTICE: CREATE TABLE/UNIQUE will create implicit index
> 'testbigint_id_key' for table 'testbigint'
> CREATE
> test=# insert into testbigint (fp0) values (1);
> INSERT 333698 1
> test=# update testbigint set fp0 = -9223372036854775808 where id = 1;
> ERROR: int8 value out of range: "-9223372036854775808"

Yes, it's failing on precisely the minimum value. It appears
that the code that does this sets the sign and then makes the number
and applies the sign at the end which would be wrong in this
case (as it overflows on 9223372036854775808)

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.

Attachment Content-Type Size
int8.patch text/plain 1.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Paul Ramsey 2001-08-07 18:46:36 Re: contrib/postgis spatial extensions
Previous Message Bruce Momjian 2001-08-07 18:26:19 Re: contrib/postgis spatial extensions