Re: FW: [JDBC] BIGINT vs Java's long - Mailing list pgsql-hackers

From Stephan Szabo
Subject Re: FW: [JDBC] BIGINT vs Java's long
Date
Msg-id Pine.BSF.4.21.0108071122390.34686-200000@megazone23.bigpanda.com
Whole thread Raw
In response to FW: [JDBC] BIGINT vs Java's long  ("Dave Cramer" <dave@fastcrypt.com>)
Responses Re: FW: [JDBC] BIGINT vs Java's long
List 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.

pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: To be 7.1.3 or not to be 7.1.3?
Next
From: Neil Tiffin
Date:
Subject: Re: Proposal: OID wraparound: summary and proposal