Re: MySQL INSERT bug?
Ed Korthof <[email protected]> Fri, 12 Nov 2004 18:06:11 -0800
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Nov 13, 2004 at 08:26:13AM +0800, [email protected] wrote: > SQL server version: 4.1.17 > Character Set: gbk > > Table structure: > Field Type Collation > _rec int(10) unsigned > _timestamp timestamp > PARENT varchar(8) gbk_chinese_ci > TYPE char(1) gbk_chinese_ci > CHILD varchar(8) gbk_chinese_ci > QTY double > ECNNO varchar(5) gbk_chinese_ci > ALTPART char(1) gbk_chinese_ci > EFF_DTE date > > > The problem is all single bytes characters are treated as double > bytes characters when use "INSERT INTO" command. > INSERT INTO bi VALUES (NULL,NULL,'41-005422SJL-01','P','01-0010600C-00 ',1.0000,' ',' ','20040326'); CHILD. The strings above are longer. > INSERT INTO bi VALUES (NULL,NULL,'û¶þÃýÃÃÃÃ¥ÃùÃðÃ','P','01-0214200M-08 ',1.0000,' ',' ','20040326'); > INSERT INTO bi VALUES (NULL,NULL,'41-0ÃýÃÃÃÃ¥ÃùÃðÃ','P','01-0214200M-08 ',1.0000,' ',' ','20040326'); Your table definition allows for exactly 8 characters for PARENT and CHILD. The strings above are longer. > > The results(SELECT * FROM bi): > _rec _timestamp PARENT TYPE CHILD QTY ECNNO ALTPART EFF_DTE > 1 2004-11-11 09:00:26 41-00542 P 01-00106 1 2004-03-26 41-00542 01-00106 01234567 01234567 This is the first 8 characters of the string you provided. It looks like MySQL is truncating at character boundaries respecting the encoding in use and the column definitions. > 2 2004-11-11 09:00:26 û¶þÃýÃÃÃÃ¥ÃùÃðà P 01-02142 1 2004-03-26 > 3 2004-11-11 09:00:26 41-0ÃýÃÃÃÃ¥Ãù P 01-02142 1 2004-03-26 > > > Is it a bug of MySQL or I just make some mistake? It looks like you want wider columns. thanks -- Ed -- +=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-= | Ed Korthof | [email protected] | 650-228-2527 | +=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-= -- MySQL Bugs Mailing List For list archives: http://lists.mysql.com/bugs To unsubscribe: http://lists.mysql.com/[email protected]