Bug #35374 div_precision_increment is not working with table’s column
Submitted: 18 Mar 2008 7:19 Modified: 24 Mar 2008 16:20
Reporter: Salman Rawala Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.1.22, 5.1.23 OS:Windows
Assigned to: CPU Architecture:Any
Tags: div_precision_increment

[18 Mar 2008 7:19] Salman Rawala
Description:
When we check effect of div_precision_increment on table’s column, we can see that this variable does not affect data from any table

How to repeat:
CREATE TABLE t1
(
id INT NOT NULL auto_increment,
PRIMARY KEY (id),
name VARCHAR(30),
salary LONG
);

## Setting session value of variable to 3 ##
SET @@session.div_precision_increment = 3;
## Inserting some rows in table ##
INSERT into t1(name, salary) values('Record_1', 100011);
INSERT into t1(name, salary) values('Record_2', 501);
INSERT into t1(name, salary) values('Record_3', 210);
SELECT name, salary, ((salary * 2.5)/1000) AS INCOME from t1;
name	salary	INCOME
Record_1	100011	250.0275
Record_2	501	1.2525
Record_3	210	0.525
'Bug: div_precision is not working with table column'; 

Suggested fix:
div_precision_increment should work for calculation with columns
[18 Mar 2008 10:29] Valeriy Kravchuk
Thank you for a bug report. Verified just as described.
[24 Mar 2008 16:20] Sergei Golubchik
Not a bug. Check SHOW CREATE TABLE to see what type your 'salary' column has.
Documented here: http://dev.mysql.com/doc/refman/5.0/en/blob.html