1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Bug #6379: ENUM values are incorrectly converted

- add_field_to_list() now uses <List>String
instead of TYPELIB to be able to distinguish
literals 'aaa' and hex literals 0xaabbcc.
- move some code from add_field_to_list() where
  we don't know column charset yet, to 
  mysql_prepare_table(), where we do.
This commit is contained in:
bar@mysql.com
2004-12-02 12:48:43 +04:00
parent 015b6f4136
commit a09a603d83
8 changed files with 214 additions and 88 deletions

View File

@@ -1693,3 +1693,35 @@ oe
ue
ss
DROP TABLE t1;
CREATE TABLE t1 (
a ENUM('<27>','<27>','<27>') character set utf8 default '<27>'
);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('<27>','<27>','<27>') character set utf8 default '<27>'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values ('<27>'), ('<27>'), ('<27>');
select a from t1 order by a;
a
<EFBFBD>
<EFBFBD>
<EFBFBD>
drop table t1;
set names utf8;
CREATE TABLE t1 (
a ENUM('ä','ö','ü') character set latin1 default 'ü'
);
insert into t1 values ('ä'),('ö'),('ü');
set names latin1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('<27>','<27>','<27>') default '<27>'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select a from t1 order by a;
a
<EFBFBD>
<EFBFBD>
<EFBFBD>
drop table t1;

View File

@@ -72,3 +72,31 @@ CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
INSERT INTO t1 VALUES ('<27>'),('<27>'),('<27>'),('<27>');
SELECT * FROM t1;
DROP TABLE t1;
#
# Bug #6379: ENUM values are incorrectly converted
#
# Check latin1 -> utf8 conversion
#
CREATE TABLE t1 (
a ENUM('<27>','<27>','<27>') character set utf8 default '<27>'
);
show create table t1;
insert into t1 values ('<27>'), ('<27>'), ('<27>');
select a from t1 order by a;
drop table t1;
#
# Now check utf8 -> latin1 conversion
# This test emulates loading a script generated with mysqldump
#
set names utf8;
CREATE TABLE t1 (
a ENUM('ä','ö','ü') character set latin1 default 'ü'
);
insert into t1 values ('ä'),('ö'),('ü');
# Now check what has been loaded
set names latin1;
show create table t1;
select a from t1 order by a;
drop table t1;