summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2004-12-02 12:48:43 +0400
committerunknown <bar@mysql.com>2004-12-02 12:48:43 +0400
commit5167b5f0ce57368d99d73e3299e8d891e5fb322a (patch)
tree032eccb9c9465fa32dfd86785d466e119d7ee865 /mysql-test
parentef13523dbc01c5be7587f62c311d762bbd4c3aed (diff)
downloadmariadb-git-5167b5f0ce57368d99d73e3299e8d891e5fb322a.tar.gz
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.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/type_enum.result32
-rw-r--r--mysql-test/t/type_enum.test28
2 files changed, 60 insertions, 0 deletions
diff --git a/mysql-test/r/type_enum.result b/mysql-test/r/type_enum.result
index da85ffe6495..15f16e4d02d 100644
--- a/mysql-test/r/type_enum.result
+++ b/mysql-test/r/type_enum.result
@@ -1693,3 +1693,35 @@ oe
ue
ss
DROP TABLE t1;
+CREATE TABLE t1 (
+a ENUM('ä','ö','ü') character set utf8 default 'ü'
+);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` enum('ä','ö','ü') character set utf8 default 'ü'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('ä'), ('ö'), ('ü');
+select a from t1 order by a;
+a
+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('ä','ö','ü') default 'ü'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select a from t1 order by a;
+a
+drop table t1;
diff --git a/mysql-test/t/type_enum.test b/mysql-test/t/type_enum.test
index dc2e4d0f469..2c4bbdf8355 100644
--- a/mysql-test/t/type_enum.test
+++ b/mysql-test/t/type_enum.test
@@ -72,3 +72,31 @@ CREATE TABLE t1 (c enum('ae','oe','ue','ss') collate latin1_german2_ci);
INSERT INTO t1 VALUES ('ä'),('ö'),('ü'),('ß');
SELECT * FROM t1;
DROP TABLE t1;
+
+#
+# Bug #6379: ENUM values are incorrectly converted
+#
+# Check latin1 -> utf8 conversion
+#
+CREATE TABLE t1 (
+ a ENUM('ä','ö','ü') character set utf8 default 'ü'
+);
+show create table t1;
+insert into t1 values ('ä'), ('ö'), ('ü');
+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;