Warning - Encountered illegal value '' when converting to DECIMAL

Asked by Peter (Stig) Edwards on 2012-05-25

Thank you for mariadb.

A colleague noticed mariadb warning in a case where MySQL did not. I am wondering if the behaviour is expected, and because the reproducer test case required a table with over a certain number of rows I am wondering if it is a bug.

Tested with revision 3533 of mariadb 5.3.8 from today from:
  http://terrier.askmonty.org/archive/pack/5.3/build-2214/kvm-bintar-hardy-amd64/mariadb-5.3.8-Linux-x86_64.tar.gz
from:
  http://buildbot.askmonty.org/buildbot/builders/kvm-bintar-hardy-amd64/builds/1676
and mariadb 5.3.6, both issue the warning while MySQL 5.1.48 and 5.1.63 do not.

The same result table is produced, it is just the warning that is the difference. Thanks.

# MTR test case:

--disable_query_log

--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
CREATE TABLE t1 ( f1 int(10) unsigned NOT NULL, f2 decimal(20,6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--enable_warnings

# 11000 yes
# 10999 no
let $i= 11000;
while ($i)
{
  eval INSERT INTO t1 values($i,$i);
  dec $i;
}

INSERT INTO t1 values(11001,NULL);
INSERT INTO t1 values(11001,NULL);

--enable_query_log

CREATE TABLE t2 SELECT MIN(f2), ROUND(AVG(f2),6), SUM(f2) FROM t1 GROUP BY f1;
SELECT @@warning_count;
SHOW WARNINGS;

# Causes warning: "Error 1918 Encountered illegal value '' when converting to DECIMAL"

--disable_query_log
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings

exit;

# End of MTR test case

Question information

Elena Stepanova (elenst) said : #1

I believe it's a bug, at the very list the behavior is inconsistent. I refiled it as https://bugs.launchpad.net/maria/+bug/1004615 on your behalf.

Can you help with this problem?

Provide an answer of your own, or ask Peter (Stig) Edwards for more information if necessary.

To post a message you must log in.