Bug #53469 | Concat eating up space characters | ||
---|---|---|---|
Submitted: | 6 May 2010 17:08 | Modified: | 31 Dec 2010 19:12 |
Reporter: | a b | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S3 (Non-critical) |
Version: | 5.0.67 | OS: | Linux |
Assigned to: | CPU Architecture: | Any | |
Tags: | concat, space |
[6 May 2010 17:08]
a b
[6 May 2010 17:21]
Valeriy Kravchuk
I think this is not a bug actually, as our manual (http://dev.mysql.com/doc/refman/5.0/en/char.html) clearly says: "When CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed." Like this: mysql> create table tc(c1 char(3)); Query OK, 0 rows affected (0.06 sec) mysql> insert into tc values (' '), (' '), (' '); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> select c1, length(c1) from tc; +------+------------+ | c1 | length(c1) | +------+------------+ | | 0 | | | 0 | | | 0 | +------+------------+ 3 rows in set (0.00 sec) mysql> alter table tc modify c1 varchar(3); Query OK, 3 rows affected (0.40 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> delete from tc; Query OK, 3 rows affected (0.00 sec) mysql> insert into tc values (' '), (' '), (' '); Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> select c1, length(c1) from tc; +------+------------+ | c1 | length(c1) | +------+------------+ | | 1 | | | 2 | | | 3 | +------+------------+ 3 rows in set (0.00 sec)
[6 Jun 2010 23:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".
[29 Dec 2010 0:22]
Haluk Turan
use CONCAT_WS this meas concatenate with seperator explaned in http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat-ws
[31 Dec 2010 19:12]
Sveta Smirnova
Closing as "Not a Bug" because the reason which Valeriy provided earlier.