Bug #5291 float -> string, truncation, sometimes without warning
Submitted: 30 Aug 2004 12:52 Modified: 6 Sep 2004 12:45
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 OS:
Assigned to: Ramil Kalimullin CPU Architecture:Any

[30 Aug 2004 12:52] Matthias Leich
Description:
A truncation occurs, if I assign a "big" float number to a string. 
Sometimes I miss the warning.
Example:
drop table if exists t1 ;
create table t1
( c1  tinyint, c20 char(2), c21 char(100), primary key(c1)) ;
insert into t1 ( c1, c20, c21 ) values ( 50, '500', '500' ) ;
Warnings:
Warning 1265    Data truncated for column 'c20' at row 1
insert into t1 ( c1, c20, c21 ) values ( 51, 500, 500 ) ;
Warnings:
Warning 1265    Data truncated for column 'c20' at row 1
insert into t1 ( c1, c20, c21 ) values ( 52, -5.0E+2, -5.0E+2 ) ;
Warnings:
Warning 1265    Data truncated for column 'c20' at row 1
set @arg00= 500.0 ;
insert into t1 ( c1, c20, c21 ) values ( 53, @arg00, @arg00 ) ;
Warnings:
Warning 1265    Data truncated for column 'c20' at row 1
insert into t1 ( c1, c20, c21 ) values ( 54, 500.0, 500.0 ) ;
            <- Where is the warning ?
insert into t1 ( c1, c20, c21 ) values ( 55, +5.0E+2, +5.0E+2 ) ;
            <- Where is the warning ?
insert into t1 ( c1, c20, c21 ) values ( 56, +5000E+2, +5000E+2 ) ;
             <- Where is the warning ?
select * from t1;
c1      c20     c21            Input                truncation warning  
50      50      500           '500'                 yes
51      50      500           500                   yes
52      -5      -500           -5.0E+20           yes 
53      50      500            @arg00=500.0  yes
54      5e      500            500.0               no
55      5e      500            5.0E+2             no
56      5e      500000       +5000E+2        no

Around the middle of August 2004 I got in my tests most or all
of the expected truncation warnings. They disappeared later.

My environment:
   - Intel PC with Linux(SuSE 9.0)
   - MySQL 4.1 compiled from source
        last ChangeSet@1.2022, 2004-08-28

How to repeat:
Please use my test file, copy it to mysql-test/t
  ./mysql-test-run ml_err29
[30 Aug 2004 12:55] Matthias Leich
test case

Attachment: ml_err29.test (application/octet-stream, text), 855 bytes.

[30 Aug 2004 12:56] Matthias Leich
expected results

Attachment: ml_err29.result (application/octet-stream, text), 1.09 KiB.

[31 Aug 2004 5:53] MySQL Verification Team
Thank you for the bug report I was able to repeat with latest Windows
server.
[1 Sep 2004 8:01] Brian Aker
Documented well enough Paul?
[2 Sep 2004 14:25] Sergei Golubchik
missing warning is a bug
[6 Sep 2004 12:45] Ramil Kalimullin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html