Bug #25815 Data truncated for column TEXT

Submitted: 24 Jan 2007 10:24 Modified: 15 Mar 2007 4:29
Reporter: Victoria Reznichenko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.32 OS:Any (any)
Assigned to: Alexander Barkov CPU Architecture:Any
Tags: character set

[24 Jan 2007 10:24] Victoria Reznichenko
Description:
If you try to insert utf8 data into cp932 table, MySQL truncates data:

mysql> create table t1 (a text) default character set cp932;
Query OK, 0 rows affected (0.02 sec)

mysql> insert into t1 values (_utf8 0xE38182);
Query OK, 1 row affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+----------------------------------------+
| Level   | Code | Message                                |
+---------+------+----------------------------------------+
| Warning | 1265 | Data truncated for column 'a' at row 1 |
+---------+------+----------------------------------------+
1 row in set (0.00 sec)

mysql> select * from t1;
+------+
| a    |
+------+
| Ц│┌  |
+------+
1 row in set (0.00 sec)

mysql> select hex(a) from t1;
+--------+
| hex(a) |
+--------+
| 82A0   |
+--------+
1 row in set (0.00 sec)

How to repeat:
set names utf8;
drop table if exists t1;
create table t1 (a text) default character set cp932;
insert into t1 values (_utf8 0xE38182);
show warnings;
select * from t1;
select hex(a) from t1;
[24 Jan 2007 12:37] 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/18702
[8 Mar 2007 8:34] Andrei Elkin
pushed to 5.0.38,5.1.17-beta
[15 Mar 2007 4:25] Paul DuBois
Noted in 5.0.38, 5.1.17 changelogs.

Inserting utf8 data into a cp932 column resulted in truncated data.
[15 Mar 2007 4:29] Paul DuBois
Updated changelog entry:

Inserting utf8 data into a TEXT column that used a single-byte
character set could result in spurious warnings about truncated data.

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

Page generated in 0.046 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.