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

Data truncated for column 'h_data' at row #16

Open
siddontang opened this issue Jul 7, 2019 · 0 comments
Open

Data truncated for column 'h_data' at row #16

siddontang opened this issue Jul 7, 2019 · 0 comments

Comments

@siddontang
Copy link

I find that the length of h_data field in the history table is 24.

mysql> desc history1;

+----------+--------------+------+------+---------+-------+
| Field    | Type         | Null | Key  | Default | Extra |
+----------+--------------+------+------+---------+-------+
| h_c_id   | int(11)      | YES  |      | NULL    |       |
| h_c_d_id | tinyint(4)   | YES  |      | NULL    |       |
| h_c_w_id | smallint(6)  | YES  | MUL  | NULL    |       |
| h_d_id   | tinyint(4)   | YES  |      | NULL    |       |
| h_w_id   | smallint(6)  | YES  | MUL  | NULL    |       |
| h_date   | datetime     | YES  |      | NULL    |       |
| h_amount | decimal(6,2) | YES  |      | NULL    |       |
| h_data   | varchar(24)  | YES  |      | NULL    |       |
+----------+--------------+------+------+---------+-------+
8 rows in set (0.00 sec)

but https://github.com/Percona-Lab/sysbench-tpcc/blob/master/tpcc_run.lua#L406 inserts a data which length is 25, so here we will meet a warning, I reproduce it in MySQL 5.7.

mysql> INSERT INTO history1 (h_c_d_id, h_c_w_id, h_c_id, h_d_id,  h_w_id, h_date, h_amount, h_data) VALUES (6,1,642,6,1,NOW(),5,'name-ussgn name-zamed    ');
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> SHOW WARNINGS;
+-------+------+---------------------------------------------+
| Level | Code | Message                                     |
+-------+------+---------------------------------------------+
| Note  | 1265 | Data truncated for column 'h_data' at row 1 |
+-------+------+---------------------------------------------+
1 row in set (0.00 sec)

Do we need to adjust to insert 24 chars or alert the history field length?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant