Bug #15480 Warning message contains junk
Submitted: 5 Dec 2005 10:03 Modified: 10 Mar 2006 18:14
Reporter: Alexander Nozdrin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.18-BK-debug, 5.0.17 OS:Linux (Linux)
Assigned to: Alexey Botchkov CPU Architecture:Any

[5 Dec 2005 10:03] Alexander Nozdrin
Description:
A warning message about assigning string value
to DECIMAL column (or SP-var) contains junk
in "value" argument.

How to repeat:
mysql> CREATE TABLE t1(c DECIMAL(64, 2));
Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO t1 VALUE(REPEAT('a', 100));
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> SHOW WARNINGS;
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                                                                           |
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1366 | Incorrect decimal value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa??@??@9%@(S???@??@??' for column 'c' at row 1 |
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> delimiter |
mysql> CREATE PROCEDURE p1()
    -> BEGIN
    ->   DECLARE v DECIMAL(64, 2) SIGNED DEFAULT REPEAT('a', 100);
    -> END|
Query OK, 0 rows affected (0.00 sec)

mysql> CALL p1()|
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> SHOW WARNINGS|
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                                                         |
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1366 | Incorrect decimal value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa?$??@' for column 'v' at row 1 |
+---------+------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT VERSION();
+-------------------------------+
| VERSION()                     |
+-------------------------------+
| 5.0.17-valgrind-max-debug-log |
+-------------------------------+
1 row in set (0.00 sec)
[5 Dec 2005 10:32] Valeriy Kravchuk
Thank you for a problem report. Sorry, but I was not able to repeat it with 5.0.17-BK (ChangeSet@1.1973, 2005-12-03 20:52:34+01:00, kent@mysql.com) on my Fedora Core 1 box:

mysql> CREATE TABLE t1(c DECIMAL(64, 2));
Query OK, 0 rows affected (0,00 sec)

mysql> INSERT INTO t1 VALUE(REPEAT('a', 100));
Query OK, 1 row affected, 1 warning (0,07 sec)

mysql> show warnings;
+---------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message           |
+---------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1366 | Incorrect decimal value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' for column 'c' at row 1 |
+---------+------+---------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,01 sec)

mysql> delimiter //
mysql> create procedure p1() begin   declare v decimal(64,2) signed default repeat('a', 100); end//
Query OK, 0 rows affected (0,00 sec)

mysql> call p1()//
Query OK, 0 rows affected (0,01 sec)

mysql> select version();
    -> //
+-----------+
| version() |
+-----------+
| 5.0.17    |
+-----------+
1 row in set (0,03 sec)

Please, check the ChangeSet you used. Any other ideas on what should I change to repeat the behaviour you described are also welcomed.
[8 Dec 2005 11:44] Alexander Nozdrin
I tested after 5.0.17-clone-off with CS1.1990.

It seems, the problem appears only in valgrind-build.
I also tried debug-build, but it works correctly then.
[20 Dec 2005 18:38] Valeriy Kravchuk
Strange, but I was able to get that junk with latest 5.0.18-BK (ChangeSet@1.1994, 2005-12-20 00:47:50+01:00) build with debug, even without valgrind:

mysql> CREATE TABLE t1(c DECIMAL(64, 2));
Query OK, 0 rows affected (0,06 sec)

mysql> INSERT INTO t1 VALUE(REPEAT('a', 100));
Query OK, 1 row affected, 1 warning (0,00 sec)

mysql> show warnings;
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                  |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1366 | Incorrect decimal value: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(FH
X??' for column 'c' at row 1 |
+---------+------+----------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0,00 sec)

mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.0.18-debug |
+--------------+
1 row in set (0,00 sec)

So, there is some kind of a problem here.
[16 Jan 2006 13:22] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/1138
[14 Feb 2006 8:54] Alexander Barkov
I would suggest not to fix error message format in 5.0.16 to avoid
upgrade/downgrade problems. Please talk to Monty or Serg.

If changeing the format is ok, then remove "tmp" in Field::check_int(),
use str and length instead.
[3 Mar 2006 13:31] Alexander Barkov
This patch looks ok to pus:
http://lists.mysql.com/commits/3427
[10 Mar 2006 18:14] Paul DuBois
Noted in 5.0.20 changelog.

The server displayed garbage in the error message warning
about bad assignments to <literal>DECIMAL</literal> columns or
routine variables. (Bug #15480)