BUG REPORT - Mailing list pgsql-bugs

From EMOTO Masahiko
Subject BUG REPORT
Date
Msg-id 19991009152003R.emo@nifs.ac.jp
Whole thread Raw
List pgsql-bugs

Your name        :EMOTO Masahiko
Your email address    :emo@nifs.ac.jp


System Configuration
---------------------
  Architecture (example: Intel Pentium)      :Intel PentiumII

  Operating System (example: Linux 2.0.26 ELF)     :RedHat 6.0 (2.2.5-15smp)

  PostgreSQL version (example: PostgreSQL-6.5.2):   PostgreSQL-6.5.2

  Compiler used (example:  gcc 2.8.0)        :egcs-2.91.66


Please enter a FULL description of your problem:
------------------------------------------------
Evaluationg following SQL cause parse error.
It seems that there's a bug parsing negative floating value
that has more than 15 digits after the period.

> db1=> create table foo ( d float );
> CREATE
> db1=> insert into foo values ( -0.123456789012345 );
> INSERT 178112 1
> db1=> insert into foo values ( -0.1234567890123456 );
> ERROR:  Unable to convert left operator '-' from type 'unknown'
> db1=> insert into foo values ( 0.1234567890123456 );
> INSERT 178113 1
> db1=> insert into foo values ( 0.12345678901234567 );
> INSERT 178114 1

This makes another problem because Java's Double.toString(double ) methods
returns the following expression, so JDBC's PreparedStatement.setDouble(int,double)
may fail.

>public class Test {
>  static public void main(String args[]){
>     double d = 1.0 / 7.0;
>     System.out.println(d);
>  }
>}
>
>% java Test
>0.14285714285714285


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------





If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------



pgsql-bugs by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: [BUGS] 6.5.2 BUG: Rolling back after dropping a table causes dangling relationships.
Next
From: "Duncan Kinder"
Date:
Subject: Three Regression Test Problems involving dates