Description:
When sql_mode='traditional', all "divide by 0" operations
must fail with SQLSTATE 22012 division by zero. This
used to work correctly (except with MOD, see related
Bug #5929) but, since the push of the precision math
code, the server now returns NULL instead of a failure.
How to repeat:
mysql> set sql_mode=traditional;
Query OK, 0 rows affected (0.00 sec)
mysql> create table t (col1 int, col2 decimal(10,3), col3 numeric(10,3));
Query OK, 0 rows affected (0.00 sec)
mysql> insert into t values (1,123.456,123.456);
Query OK, 1 row affected (0.00 sec)
mysql> select col1/0 from t;
+--------+
| col1/0 |
+--------+
| NULL |
+--------+
1 row in set, 1 warning (0.00 sec)
-- This is not the expected result. This operation should
fail, and return SQLSTATE 22012 division by zero.
mysql> select col2/0 from t;
+--------+
| col2/0 |
+--------+
| NULL |
+--------+
1 row in set, 1 warning (0.00 sec)
-- This is not the expected result. This operation should
fail, and return SQLSTATE 22012 division by zero.
mysql> select col3/0 from t;
+--------+
| col3/0 |
+--------+
| NULL |
+--------+
1 row in set, 1 warning (0.00 sec)
-- This is not the expected result. This operation should
fail, and return SQLSTATE 22012 division by zero.