Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] int8-datatype: possible bug

From: José Soares <jose(at)sferacarta(dot)com>
To: Jelle Ruttenberg <ruttenberg(at)neroc(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org
Subject: Re: [GENERAL] int8-datatype: possible bug
Date: 1999-05-07 14:56:27
Message-ID: 3732FF1B.E450CA54@sferacarta.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-general
Seems that your platform has problems with int8.
Here the begining of  ../contrib/int8/README  from Thomas G. Lockhart. Try to
ask him :)
-----------------------------------------------------------------------
Thomas G. Lockhart <Thomas(dot)Lockhart(at)jpl(dot)nasa(dot)gov>

This is a first attempt at 64-bit integer arithmetic for Postgres. The code
should support any 64-bit architecture and any 32-bit machine using a recent
GNU C compiler. At the moment, DEC-Alpha and Linux/gcc are explicitly
supported. The code uses "long long int" support in GNU C on 32-bit machines.
This type is an extension to ANSI-C, and may not appear on any other compiler.

The modules are built and installed as user-defined types, so destination
 directories are pointing away from the standard Postgres areas.

Other compilers and architectures should be supportable, so please let me know
what changes were required to run on your machine, and I will fold those into
this standard distribution.
----------------------------------------------------------------------------------

Jelle Ruttenberg ha scritto:

> Hello José Soares,
>
> thank you. I tried your testcase and all input was changed in the magical
> value. The 'NOTICE' disappeared when I quoted the value, but the result
> was all the same.
>
> edahrecepten=> create table test(i8 int8);
> CREATE
> edahrecepten=> insert into test values(19980528112607 );
> NOTICE:  Integer input '19980528112607' is out of range; promoted to float
> INSERT 147055 1
> edahrecepten=> select * from test;
>                  i8
> -------------------
> 9223091440198811892
> (1 row)
>
> edahrecepten=> insert into test values('19980528112607' );
> INSERT 147056 1
> edahrecepten=> select * from test;
>                  i8
> -------------------
> 9223091440198811892
> 9223091440198811892
> (2 rows)
>
> edahrecepten=> insert into test values('19980528112607'::int8);
> INSERT 147057 1
> edahrecepten=> select * from test;
>                  i8
> -------------------
> 9223091440198811892
> 9223091440198811892
> 9223091440198811892
> (3 rows)
>
> edahrecepten=> select version();
> version
> ----------------------------------------------------
> PostgreSQL 6.4.2 on mips-sgi-irix6.2, compiled by cc
> (1 row)
>
> So for the time being I use float8...
>
> Jelle.
>
> >Jelle Ruttenberg ha scritto:
> >
> >> Hello all,
> >>
> >> when I try to put a numeric 'timestamp' like 19980528112607 into an
> >> int8-datatype I get the notice 'NOTICE:  Integer input '19980528112607'
> >> is out of range; promoted to float' and the value is put in the database
> >> as 9223091508918288644.
> >> It doesn't matter if I change the value: it will allways be the magical
> >> value 9223091508918288644.
> >>
> >> When I use the float8-datatype it all goes well.
> >>
> >> Is this a bug in PostgreSQL or has it something to do with
> >> platform-specific limitations?
> >>
> >> Thanks,
> >>
> >> Jelle.
> >>
> >> PostgreSQL: 6.4.2
> >> Platform: SGI IRIX 6.2. IP22
> >>
> >> --------------------------------------------------------------
> >>                    NEROC Publishing Solutions
> >>
> >>                       Jelle Ruttenberg
> >>
> >> De Run 1131, 5503 LB Veldhoven    Phone  : +31-(0)40-2586641
> >> P.O.Box 133, 5500 AC Veldhoven    Fax    : +31-(0)40-2541893
> >> The Netherlands                   E-mail : ruttenberg(at)neroc(dot)nl
> >> --------------------------------------------------------------
> >
> >Let me try on v6.5beta1...
> >
> >prova=> create table test(i8 int8);
> >CREATE
> >prova=> insert into test values(19980528112607 );
> >NOTICE:  Integer input '19980528112607' is out of range; promoted to float
> >INSERT 145481 1
> >prova=> insert into test values('19980528112607' );
> >INSERT 145482 1
> >prova=> insert into test values('19980528112607'::int8);
> >INSERT 145483 1
> >prova=> select * from test;
> >            i8
> >--------------
> >19980528112607
> >19980528112607
> >19980528112607
> >(3 rows)
> >
> >
> >Seems that works fine. And now trying bounds...
> >
> >prova=> insert into test values(-9223372036854775808);
> >NOTICE:  Integer input '9223372036854775808' is out of range; promoted to
> >float
> >ERROR:  Floating point conversion to int64 is out of range
> >prova=> insert into test values('-9223372036854775808');
> >INSERT 145486 1
> >prova=> insert into test values(9223372036854775807);
> >NOTICE:  Integer input '9223372036854775807' is out of range; promoted to
> >float
> >ERROR:  Floating point conversion to int64 is out of range
> >prova=> insert into test values('9223372036854775807');
> >INSERT 145487 1
> >prova=> select * from test;
> >                  i8
> >--------------------
> >      19980528112607
> >      19980528112607
> >      19980528112607
> >-9223372036854775808
> > 9223372036854775807
> >(5 rows)
> >
> >
> >It works if the data is enclosed with ''. :)
> >
> >prova=> select version();
> >version
> >-------------------------------------------------------------------
> >PostgreSQL 6.5.0 on i586-pc-linux-gnulibc1, compiled by gcc 2.7.2.1
> >(1 row)
> >
> >Jose'
> >
> >
>
> --------------------------------------------------------------
>                    NEROC Publishing Solutions
>
>                       Jelle Ruttenberg
>
> De Run 1131, 5503 LB Veldhoven    Phone  : +31-(0)40-2586641
> P.O.Box 133, 5500 AC Veldhoven    Fax    : +31-(0)40-2541893
> The Netherlands                   E-mail : ruttenberg(at)neroc(dot)nl
> --------------------------------------------------------------


In response to

pgsql-bugs by date

Next:From: Herouth MaozDate: 1999-05-09 11:54:12
Subject: Re: [GENERAL] int8-datatype: possible bug
Previous:From: Peter GalbavyDate: 1999-05-07 14:26:57
Subject: did this ever get integrated ? (for OpenBSD)

pgsql-general by date

Next:From: Carlos Peralta RamirezDate: 1999-05-07 14:56:44
Subject: Functions for arrays !!!!
Previous:From: Mike DaganDate: 1999-05-07 14:02:40
Subject: Many records has been removed.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group