Обсуждение: Int8 problem
Hi I have intalled Postgres 7.0.2 on a Compaq Alpha with DigitalUnix. If I insert a bigger number like 10^13 in an int8 type field i'm getting no error messages, no warnings, but if I check the value inserted i receive totaly wrong number like 2543........ If you have any suggestions please let me know. Thank any way.
"admin" <admin@mmelectrica.ro> writes:
> I have intalled Postgres 7.0.2 on a Compaq Alpha with DigitalUnix.
> If I insert a bigger number like 10^13 in an int8 type field i'm getting no
> error messages, no warnings, but if I check the value inserted i receive
> totaly wrong number like 2543........
Hm. It sounds like configure failed to find any compiler support for
8-byte ints, so it gave up and compiled int8 as int4. But an Alpha
ought to have 8-byte ints. May we see the output files from configure
(config.status, config.log)?
regards, tom lane
----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "admin" <admin@mmelectrica.ro>
Cc: <pgsql-general@postgresql.org>
Sent: 26 septembrie 2000 16:31
Subject: Re: [GENERAL] Int8 problem
I send you the outputs maybe you will find an answer.
Thanks.
Hanos Felix
> "admin" <admin@mmelectrica.ro> writes:
> > I have intalled Postgres 7.0.2 on a Compaq Alpha with DigitalUnix.
> > If I insert a bigger number like 10^13 in an int8 type field i'm
getting no
> > error messages, no warnings, but if I check the value inserted i receive
> > totaly wrong number like 2543........
>
> Hm. It sounds like configure failed to find any compiler support for
> 8-byte ints, so it gave up and compiled int8 as int4. But an Alpha
> ought to have 8-byte ints. May we see the output files from configure
> (config.status, config.log)?
>
> regards, tom lane
Вложения
Hi, I have intalled Postgres 7.0.2 recently on 3 normal PC with RedHat and Slackware to try its behavior but its working good. int8 thakes number much bigger then 10^13. And if the number is to big (about 10^19 ) it generate an error message (ERROR: int8 value out of range: ...) and don't insert it into the table. But on the alpha i got no error message no worning and inserts a wrong number if the number is bigger than 10^13 . regard Hanos Felix ----- Original Message ----- From: "Jerome Raupach" <jraupach@intelcom.fr> To: "admin" <admin@mmelectrica.ro> Sent: 26 septembrie 2000 14:48 Subject: Re: [GENERAL] Int8 problem > your number is truncated to the biggest int8 ( 2*10^10, I think). > try with 'numeric'. > > Jerome. > > > admin wrote: > > > > Hi > > I have intalled Postgres 7.0.2 on a Compaq Alpha with DigitalUnix. > > If I insert a bigger number like 10^13 in an int8 type field i'm getting no > > error messages, no warnings, but if I check the value inserted i receive > > totaly wrong number like 2543........ > > If you have any suggestions please let me know. > > > > Thank any way.
"admin" <admin@mmelectrica.ro> writes:
> But on the alpha i got no error message no worning and inserts a wrong
> number if the number is bigger than 10^13 .
10^13? But values > 2^31 work? Man, that's really weird ... I was
expecting a failure at 2^31 if int8 wasn't compiled correctly.
I can't think what might fail at 10^13. Ideas anyone?
It might help to see an exact table of equivalences, ie, so much
in, so much out.
regards, tom lane
Tom your right. I take a detailed look at it and it fails exactly at 2^31 . 2^31-1 = 2147483647 --> 2147483647 2^31 = 2147483648 --> -2147483648 2^31+1= 2147483649 --> -2147483647 ..... 10^10 --> 1410065408 10^12 --> -727379968 ... But how could i compile the int8 corectly? - Original Message ----- From: "Tom Lane" <tgl@sss.pgh.pa.us> To: "admin" <admin@mmelectrica.ro> Cc: "Jerome Raupach" <jraupach@intelcom.fr>; <pgsql-general@postgresql.org> Sent: 27 septembrie 2000 08:43 Subject: Re: [GENERAL] Int8 problem > "admin" <admin@mmelectrica.ro> writes: > > But on the alpha i got no error message no worning and inserts a wrong > > number if the number is bigger than 10^13 . > > 10^13? But values > 2^31 work? Man, that's really weird ... I was > expecting a failure at 2^31 if int8 wasn't compiled correctly. > I can't think what might fail at 10^13. Ideas anyone? > > It might help to see an exact table of equivalences, ie, so much > in, so much out. > > regards, tom lane