Bug #119472 insert a char column like value 'aaaa ', but insert result is 'aaaa'

Submitted: 29 Nov 2025 8:01 Modified: 1 Dec 2025 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 2025 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 2025 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.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.048 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.