Bug #119472 insert a char column like value 'aaaa ', but insert result is 'aaaa'
Submitted: 29 Nov 8:01 Modified: 1 Dec 10:23
Reporter: david silva Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[29 Nov 8:01] david silva
Description:
insert a char column like value 'aaaa     ', but insert result is 'aaaa'

mysql> create table t8(c1 char(4));
Query OK, 0 rows affected (0.06 sec)

mysql> insert into t8 values ('aa  ');
Query OK, 1 row affected (0.01 sec)

mysql> select length(c1) from t8;
+------------+
| length(c1) |
+------------+
|          2 |
+------------+
1 row in set (0.00 sec)

mysql> select * from t8;
+------+
| c1   |
+------+
| aa   |
+------+
1 row in set (0.00 sec)

How to repeat:
create table t8(c1 char(4));
insert into t8 values ('aa  ');
select length(c1) from t8;
select * from t8;
[1 Dec 10:23] Roy Lyseng
This is not a bug.
The retrieval is consistent with the documented behavior when SQL mode
PAD_CHAR_TO_FULL_LENGTH SQL mode is not enabled.