From 79a23f7466e99ebfd872d213c4abbd99d448f8ab Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Mar 2005 08:36:48 +0200 Subject: fixed union types merging and table related metadata (BUG#8824) mysql-test/r/func_group.result: new result mysql-test/r/metadata.result: new result test of metadata of variables, unions and derived tables mysql-test/r/union.result: new results test of union of enum mysql-test/t/metadata.test: test of metadata of variables, unions and derived tables mysql-test/t/union.test: test of union of enum sql/field.cc: Field type merging rules added Fixed table name/alias returting for field made from temporary tables sql/field.h: removed unned field type reporting sql/item.cc: fixed bug in NEW_DATE type field creartion replaced mechanism of merging types of UNION sql/item.h: replaced mechanism of merging types of UNION sql/item_func.h: new item type to make correct field type detection possible sql/item_subselect.cc: added table name parameter to prepare() to show right table alias for derived tables sql/sql_derived.cc: added table name parameter to prepare() to show right table alias for derived tables sql/sql_lex.h: added table name parameter to prepare() to show right table alias for derived tables sql/sql_parse.cc: made function for enum/set pack length calculation sql/sql_prepare.cc: added table name parameter to prepare() to show right table alias for derived tables sql/sql_select.cc: new temporary table field creation by Item_type_holder fixed table alias for temporary table sql/sql_union.cc: added table name parameter to prepare() to show right table alias for derived tables --- mysql-test/t/union.test | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'mysql-test/t/union.test') diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 82f26f63254..88dc5e0d06a 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -711,3 +711,28 @@ select * from ((select * from t1 limit 1) union (select * from t1 limit 1) union select * from ((((select * from t1))) union (select * from t1) union (select * from t1)) a; select * from ((select * from t1) union (((select * from t1))) union (select * from t1)) a; drop table t1; + +# +# Enum merging test +# +CREATE TABLE t1 ( + a ENUM('ä','ö','ü') character set utf8 not null default 'ü', + b ENUM("one", "two") character set utf8, + c ENUM("one", "two") +); +show create table t1; +insert into t1 values ('ä', 'one', 'one'), ('ö', 'two', 'one'), ('ü', NULL, NULL); +create table t2 select NULL union select a from t1; +show columns from t2; +drop table t2; +create table t2 select a from t1 union select NULL; +show columns from t2; +drop table t2; +create table t2 select a from t1 union select a from t1; +show columns from t2; +drop table t2; +-- error 1267 +create table t2 select a from t1 union select c from t1; +create table t2 select a from t1 union select b from t1; +show columns from t2; +drop table t2, t1; -- cgit v1.2.1