Bug #9729 CHAR trailing spaces are been trimed on retrival
Submitted: 7 Apr 2005 19:03 Modified: 8 Apr 2005 18:07
Reporter: Tal Kormas Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0.3 OS:
Assigned to: CPU Architecture:Any

[7 Apr 2005 19:03] Tal Kormas
Description:
In Oracle, Informix and other database, CHAR fields will be retrieved with the trailing spaces. It would be nice it there could be a variable to allow skipping the removal of trailing spaces on retrieve (I would like to use it as a session based variable). This will allow easier migration to MySQL.

How to repeat:
1) Define the table with a char variable:
   CREATE table test(test char(10));
2) Insert into the table:
   INSERT into test(test) values('hi');
3) Select from the table will give 'hi' instead of 'hi        ').

Suggested fix:
Add a variable to script the trim function.
[8 Apr 2005 18:07] Sergei Golubchik
It's a duplicate of http://bugs.mysql.com/bug.php?id=7083.
(the latter talks only about LENGTH, but of course, it's assumed that column values are always space-padded, it's the only consistent solution)