Re: Bug with field type double unsigned

Uzi Klein <[email protected]> Thu, 06 Jan 2005 13:24:50 +0200
Newsgroups gmane.comp.db.mysql.bugs
Message-ID <[email protected]>
Sergei Golubchik wrote:
> Hi!
> 
> On Jan 05, Uzi Klein wrote:
> 
>>Hi
>>thters seems to be an error  with double unsigned fields :
> 
> 
> Could you provide a repeatable test case ?
> (that is, INSERT/UPDATE statements that would generate such a table)
> 
> I failed to repeat it with random data :(

EXAMPLE :

mysql> SELECT VERSION();
+------------+
| VERSION()  |
+------------+
| 4.0.22-log |
+------------+
1 row in set (0.00 sec)

mysql> use test;
Database changed
mysql> CREATE TABLE `TestDouble` (
     ->   `ID` int(10) unsigned NOT NULL auto_increment,
     ->   `DoubleField1` double default NULL,
     ->   `DoubleField2` double unsigned default NULL,
     ->   PRIMARY KEY  (`ID`)
     -> ) TYPE=MyISAM;
Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO TestDouble (DoubleField1) VALUES ('-12345.123');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM TestDouble;
+----+--------------+--------------+
| ID | DoubleField1 | DoubleField2 |
+----+--------------+--------------+
|  1 |   -12345.123 |         NULL |
+----+--------------+--------------+
1 row in set (0.00 sec)

mysql> UPDATE TestDouble SET DoubleField2 = DoubleField1 WHERE ID = 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> SELECT * FROM TestDouble;
+----+--------------+--------------+
| ID | DoubleField1 | DoubleField2 |
+----+--------------+--------------+
|  1 |   -12345.123 |   -12345.123 |
+----+--------------+--------------+
1 row in set (0.00 sec)



> 
> By the way, the recommended place to report bugs is our bug-tracking
> system at http://bugs.mysql.com, you will get automatic notification
> when the bug is fixed, etc.
> 

> But of course [email protected] is ok too
>  
> 
>>mysql version 4.0.22
>>red hat linux 9
>>
>>mysql> SHOW CREATE TABLE ContractPayments;
>>+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ------------------------------------------+
>>| Table            | Create Table 
>>+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ------------------------------------------+
>>| ContractPayments | CREATE TABLE `ContractPayments` (
>>  `PaymentID` int(10) unsigned NOT NULL auto_increment,
>>  `ContractID` int(10) unsigned NOT NULL default '0',
>>   `FundRemains` double unsigned default NULL,
>>  PRIMARY KEY  (`PaymentID`),
>>  KEY `ContractID` (`ContractID`)
>>  ) ENGINE=MyISAM DEFAULT  |
>>+------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ------------------------------------------+
>>1 row in set (0.00 sec)
>>
>>mysql> SELECT FundRemains FROM ContractPayments WHERE FundRemains<0;
>>+-------------+
>>| FundRemains |
>>+-------------+
>>|   -1439.252 |
>>|  -100529.06 |
>>|      -0.847 |
>>+-------------+
>>38 rows in set (0.13 sec)
>>
> 
> Regards,
> Sergei
> 

-- 
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe:    http://lists.mysql.com/[email protected]