Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating value of decimal field results to ERROR 1265 (01000): Data Truncated #5532

Closed
nanne007 opened this issue Dec 31, 2017 · 6 comments
Closed
Assignees
Labels
type/bug The issue is confirmed as a bug.

Comments

@nanne007
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.

Ref pingcap/tidb-bench#14
When doing tpcc on tidb, I came across the same problem as the issue points out.

mysql> desc decimals;
+-------+---------------+------+-----+---------+-------+
| Field | Type          | Null | Key | Default | Extra |
+-------+---------------+------+-----+---------+-------+
| a     | decimal(20,0) | NO   |     | NULL    |       |
+-------+---------------+------+-----+---------+-------+
1 row in set (0.06 sec)

mysql> select * from decimals;
+-----+
| a   |
+-----+
| 201 |
+-----+
1 row in set (0.00 sec)
  1. What did you expect to see?
mysql> update decimals set a = a + 1.23;
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

mysql> select * from decimals;
+-----+
| a   |
+-----+
| 202 |
+-----+
1 row in set (0.00 sec)
  1. What did you see instead?
mysql> update decimals set a = a + 1.23;
ERROR 1265 (01000): Data Truncated
mysql> select * from decimals;
+-----+
| a   |
+-----+
| 201 |
+-----+
1 row in set (0.00 sec)
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?
mysql> select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                           |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v1.0.4-1-ga05e014
Git Commit Hash: a05e0146bd7f085938d2631b3726cca7d102537e
Git Branch: release-1.0
UTC Build Time: 2017-12-11 03:07:11 |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.04 sec)
@shenli
Copy link
Member

shenli commented Dec 31, 2017

@lerencao Thanks for your feedback!
@XuHuaiyu PTAL

@shenli shenli added the type/bug The issue is confirmed as a bug. label Dec 31, 2017
@coocood
Copy link
Member

coocood commented Jan 1, 2018

@lerencao
Thanks for your report.
When a decimal value is truncated by precision, we should return a warning instead of an error.
We will fix it soon.

@ghost
Copy link

ghost commented Feb 6, 2018

@coocood I encountered the same problem in v1.0.7.
When will the solution be ready?

@coocood
Copy link
Member

coocood commented Feb 6, 2018

@Robert-Xie
In a few days.

@ghost
Copy link

ghost commented Feb 6, 2018

ok. Thanks.

@zz-jason
Copy link
Member

was fixed by #5801

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

5 participants