Bug #35720 ucs2 + pad_char_to_full_length = failure
Submitted: 31 Mar 2008 21:06 Modified: 17 Oct 2008 17:21
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Charsets Severity:S3 (Non-critical)
Version:5.1.25-rc-debug, 6.0.5 BK OS:Linux (SUSE 10 | 32-bit)
Assigned to: Alexander Barkov CPU Architecture:Any

[31 Mar 2008 21:06] Peter Gulutzan
Description:
I create a table with a CHAR(5) UCS2 column.
I insert 'a'.
I set @@sql_mode=pad_char_to_full_length.
I select from the table.
The result is not 'a    '.

How to repeat:
mysql> CREATE TABLE t (s1 CHAR(5) CHARACTER SET UCS2);
Query OK, 0 rows affected (0.10 sec)

mysql> INSERT INTO t VALUES ('a');
Query OK, 1 row affected (0.00 sec)

mysql> SET @@sql_mode=pad_char_to_full_length;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT HEX(s1) FROM t;
+------------------------------------------+
| HEX(s1)                                  |
+------------------------------------------+
| 00610020002000200020A5A5A5A5A5FD00610020 |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> SELECT LENGTH(s1) FROM t;
+------------+
| LENGTH(s1) |
+------------+
|         20 |
+------------+
1 row in set (0.00 sec)

mysql> select * from t;
+------------+
| s1         |
+------------+
| a    ???a  |
+------------+
1 row in set (0.00 sec)
[31 Mar 2008 21:18] Sveta Smirnova
Thank you for the report.

Verified as described.
[25 Jul 2008 9:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/50485

2677 Alexander Barkov	2008-07-25
      Bug#35720 ucs2 + pad_char_to_full_length = failure
      Problem: with @@sql_mode=pad_char_to_full_length
      a CHAR column returned additional garbage
      after trailing space characters due to
      incorrect my_charpos() call.
      Fix: call my_charpos() with correct arguments.
[15 Sep 2008 10:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/54075

2740 Alexander Barkov	2008-09-15
      Bug#35720 ucs2 + pad_char_to_full_length = failure
      Problem: with @@sql_mode=pad_char_to_full_length
      a CHAR column returned additional garbage
      after trailing space characters due to
      incorrect my_charpos() call.
      Fix: call my_charpos() with correct arguments.
[15 Sep 2008 11:42] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/54090

2740 Alexander Barkov	2008-09-15
      Bug#35720 ucs2 + pad_char_to_full_length = failure
      Problem: with @@sql_mode=pad_char_to_full_length
      a CHAR column returned additional garbage
      after trailing space characters due to
      incorrect my_charpos() call.
      Fix: call my_charpos() with correct arguments.
[15 Sep 2008 11:46] Alexander Barkov
Pushed into mysql-5.1.30-bugteam
Pushed into mysql-6.0.8-bugteam
[9 Oct 2008 18:16] Bugs System
Pushed into 5.1.30  (revid:bar@mysql.com-20080915102931-qv2ssbzbyidukpp7) (version source revid:kpettersson@mysql.com-20080915214458-ejxj7ltezohabr3z) (pib:4)
[15 Oct 2008 15:03] Paul DuBois
This is actually pushed to 5.1.29, not 5.1.30.
[15 Oct 2008 17:04] Paul DuBois
Noted in 5.1.29 changelog.

With the PAD_CHAR_TO_FULL_LENGTH SQL mode enabled, a ucs2 CHAR column
returned additional garbage after trailing space characters.

Setting report to NDI pending push into 6.0.x.
[17 Oct 2008 16:46] Bugs System
Pushed into 6.0.8-alpha  (revid:bar@mysql.com-20080915102931-qv2ssbzbyidukpp7) (version source revid:kpettersson@mysql.com-20080915213305-1ljm3tx7tgsdrne9) (pib:5)
[17 Oct 2008 17:21] Paul DuBois
Noted in 6.0.8 changelog.
[28 Oct 2008 21:06] Bugs System
Pushed into 5.1.29-ndb-6.2.17  (revid:bar@mysql.com-20080915102931-qv2ssbzbyidukpp7) (version source revid:tomas.ulin@sun.com-20081028140209-u4emkk1xphi5tkfb) (pib:5)
[28 Oct 2008 22:24] Bugs System
Pushed into 5.1.29-ndb-6.3.19  (revid:bar@mysql.com-20080915102931-qv2ssbzbyidukpp7) (version source revid:tomas.ulin@sun.com-20081028194045-0353yg8cvd2c7dd1) (pib:5)
[1 Nov 2008 9:50] Bugs System
Pushed into 5.1.29-ndb-6.4.0  (revid:bar@mysql.com-20080915102931-qv2ssbzbyidukpp7) (version source revid:jonas@mysql.com-20081101082305-qx5a1bj0z7i8ueys) (pib:5)