| Bug #12547 | Inserting long string into varchar causes table crash in cp932 | ||
|---|---|---|---|
| Submitted: | 12 Aug 2005 10:14 | Modified: | 20 Oct 2005 18:26 |
| Reporter: | Sadao Hiratsuka (Basic Quality Contributor) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S2 (Serious) |
| Version: | 5.0.10/BK source 5.0 | OS: | Linux (Linux,WindowsXP) |
| Assigned to: | Alexander Barkov | CPU Architecture: | Any |
[12 Aug 2005 10:24]
Aleksey Kishkin
confirm it for windows. plan to test on linux.
[12 Aug 2005 10:35]
Sadao Hiratsuka
It's reproducible in Windows.
And in Windows, these operation causes server crash.
root:mi> create table test (col1 varchar(1)) character set cp932;
Query OK, 0 rows affected (0.27 sec)
root:mi> insert into test values ('ab');
Query OK, 1 row affected (0.05 sec)
root:mi> select * from test;
+------+
| col1 |
+------+
| ab |
+------+
1 row in set (0.00 sec)
root:mi> insert into test values ('abc');
Query OK, 1 row affected (0.07 sec)
root:mi> select * from test;
ERROR 2013 (HY000): Lost connection to MySQL server during query
root:mi> select * from test;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)
ERROR:
Can't connect to the server
[9 Sep 2005 12:44]
MySQL Verification Team
Microsoft Windows XP [versão 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
c:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.13-beta-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create table test (col1 varchar(1)) character set cp932;
Query OK, 0 rows affected (0.11 sec)
mysql> insert into test values ('a');
Query OK, 1 row affected (0.02 sec)
mysql> insert into test values ('ab');
Query OK, 1 row affected (0.00 sec)
mysql> select * from test;
+------+
| col1 |
+------+
| a |
| ab |
+------+
2 rows in set (0.00 sec)
mysql> insert into test values ('abc');
Query OK, 1 row affected (0.00 sec)
mysql> select * from test;
ERROR 1194 (HY000): Table 'test' is marked as crashed and should be repaired
mysql>
miguel@hegel:~/dbs/5.0> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.13-beta-debug
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create table test (col1 varchar(1)) character set cp932;
Query OK, 0 rows affected (0.05 sec)
mysql> insert into test values ('a');
Query OK, 1 row affected (0.00 sec)
mysql> insert into test values ('ab');
Query OK, 1 row affected (0.00 sec)
mysql> select * from test;
+------+
| col1 |
+------+
| a |
| ab |
+------+
2 rows in set (0.00 sec)
mysql> insert into test values ('abc');
Query OK, 1 row affected (0.00 sec)
mysql> select * from test;
ERROR 1194 (HY000): Table 'test' is marked as crashed and should be repaired
mysql>
[11 Oct 2005 7:14]
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/internals/30897
[14 Oct 2005 8:57]
Alexander Barkov
Fixed in 5.0.16
[20 Oct 2005 18:26]
Paul DuBois
Noted in 5.0.16 changelog.

Description: when I insert longer string into cp932 table than column definition, MySQL can't trim string correctly, and then causes table crash. How to repeat: <<<<<problem case (cp932)>>>>> root:mi> create table test (col1 varchar(1)) character set cp932; Query OK, 0 rows affected (0.01 sec) root:mi> insert into test values ('a'); Query OK, 1 row affected (0.00 sec) root:mi> insert into test values ('ab'); Query OK, 1 row affected (0.00 sec) root:mi> select * from test; +------+ | col1 | +------+ | a | | ab | *this is incorrect. 'a' is the correct value.* +------+ 2 rows in set (0.00 sec) root:mi> insert into test values ('abc'); Query OK, 1 row affected (0.00 sec) root:mi> select * from test; ERROR 1194 (HY000): Table 'test' is marked as crashed and should be repaired *table is crashed* <<<<<correct case (sjis)>>>>> root:mi> create table test (col1 varchar(1)) character set sjis; Query OK, 0 rows affected (0.00 sec) root:mi> insert into test values ('a'); Query OK, 1 row affected (0.00 sec) root:mi> insert into test values ('ab'); Query OK, 1 row affected, 1 warning (0.00 sec) root:mi> insert into test values ('abc'); Query OK, 1 row affected, 1 warning (0.00 sec) root:mi> select * from test; +------+ | col1 | +------+ | a | | a | | a | +------+ 3 rows in set (0.00 sec)