Bug #7084 | VARCHAR columns should not strip trailing spaces | ||
---|---|---|---|
Submitted: | 7 Dec 2004 20:54 | Modified: | 11 Jan 2005 13:20 |
Reporter: | Trudy Pelzer | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.3-alpha-debug | OS: | Linux (SuSE 9.1) |
Assigned to: | Alexander Barkov | CPU Architecture: | Any |
[7 Dec 2004 20:54]
Trudy Pelzer
[8 Dec 2004 20:22]
MySQL Verification Team
Hi, Did you do it in the "traditional" mode?
[8 Dec 2004 21:06]
Trudy Pelzer
Note to Victoria: Yes, I did the test using sql_mode='traditional'. But this should make no difference to the result; the rules that I quoted should work regardless of sql_mode, now that Monty has finished the "true varchar" work.
[8 Dec 2004 21:35]
MySQL Verification Team
Verified with latest 5.0 BK tree I got the same error only with "traditional" mode. mysql> create table t1 (col1 varchar(5)); Query OK, 0 rows affected (0.14 sec) mysql> insert into t1 values ('hi'); Query OK, 1 row affected (0.01 sec) mysql> insert into t1 values ('hi '); Query OK, 1 row affected (0.00 sec) mysql> select col1,char_length(col1) from t1; +-------+-------------------+ | col1 | char_length(col1) | +-------+-------------------+ | hi | 2 | | hi | 5 | +-------+-------------------+ 2 rows in set (0.03 sec) mysql> insert into t1 values('hi '); Query OK, 1 row affected, 1 warning (0.00 sec) mysql> show warnings; +---------+------+-------------------------------------------+ | Level | Code | Message | +---------+------+-------------------------------------------+ | Warning | 1265 | Data truncated for column 'col1' at row 1 | +---------+------+-------------------------------------------+ 1 row in set (0.00 sec) mysql> drop table t1; Query OK, 0 rows affected (0.00 sec) mysql> set sql_mode="traditional"; Query OK, 0 rows affected (0.00 sec) mysql> create table t1 (col1 varchar(5)); Query OK, 0 rows affected (0.26 sec) mysql> insert into t1 values ('hi'); Query OK, 1 row affected (0.00 sec) mysql> insert into t1 values ('hi '); Query OK, 1 row affected (0.00 sec) mysql> select col1,char_length(col1) from t1; +-------+-------------------+ | col1 | char_length(col1) | +-------+-------------------+ | hi | 2 | | hi | 5 | +-------+-------------------+ 2 rows in set (0.01 sec) mysql> insert into t1 values('hi '); ERROR 1265 (01000): Data truncated for column 'col1' at row 1
[6 Jan 2005 12:01]
Sergei Golubchik
Looks like it is fixed already ?
[11 Jan 2005 13:20]
Alexander Barkov
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html Additional info: Fixed in 5.0.3