diff options
author | unknown <bell@sanja.is.com.ua> | 2003-11-23 02:01:15 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2003-11-23 02:01:15 +0200 |
commit | 3e21b667bcf164779674e0c08d8c1b9044acc2b5 (patch) | |
tree | e4fd5f08fab614b6e2c048191bd9451abd45131d /mysql-test/t/union.test | |
parent | 920c30b43a3be8955db4e03cc393dd56ac8f5239 (diff) | |
download | mariadb-git-3e21b667bcf164779674e0c08d8c1b9044acc2b5.tar.gz |
Fixed UNION fields type/length detecting
mysql-test/r/union.result:
new results with max union field length detecting
type conversion tests
mysql-test/t/union.test:
type conversion tests
sql/field.h:
field converion support
sql/item.cc:
fixed printing field of internal temporary table of SELECT (reference from HAVING clause)
layout fix
new item for storing field type
sql/item.h:
new item for storing field type
sql/item_subselect.cc:
new subquery item length/dec detecting
sql/mysql_priv.h:
we do not need pre-inited tables and fields
sql/sql_base.cc:
we do not need double fix_fielding
sql/sql_class.h:
we do not need double fix_fielding
sql/sql_derived.cc:
preparing moved before temporary table creation
sql/sql_lex.h:
we do not need pre-inited tables and fields
new lists to store fields types and fields of temporary table
sql/sql_parse.cc:
we do not need pre-inited tables and fields
sql/sql_prepare.cc:
we do not need pre-inited tables and fields
sql/sql_select.cc:
we do not need pre-inited tables and fields
support mysql_select call from derived tables after it preparing (in derived table routing)
support of crreating temporary table fields from Item_type_holder
sql/sql_select.h:
we do not need pre-inited tables and fields
sql/sql_union.cc:
we do not need pre-inited tables and fields
check of columns number in union moved to prepare()
prepering of SELECTS moved before temporary table creation, fixed union columns type/length detecting
sql/sql_update.cc:
we do not need pre-inited tables and fields
Diffstat (limited to 'mysql-test/t/union.test')
-rw-r--r-- | mysql-test/t/union.test | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 3cfdc14b0b8..af511d18ecc 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -302,3 +302,85 @@ insert into t1 values (NULL, 'a', 1), (NULL, 'b', 2), (NULL, 'c', 3), (NULL, 'd' insert into t2 values (1, 100), (1, 101), (1, 102), (2, 100), (2, 103), (2, 104), (3, 101), (3, 102), (3, 105); SELECT mp.pla_id, MIN(m1.matintnum) AS matintnum FROM t2 mp INNER JOIN t1 m1 ON mp.mat_id=m1.mat_id GROUP BY mp.pla_id union SELECT 0, 0; drop table t1, t2; + +# +# types conversions +# + + +create table t1 SELECT "a" as a UNION select "aa" as a; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT 12 as a UNION select "aa" as a; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT 12 as a UNION select 12.2 as a; +select * from t1; +show create table t1; +drop table t1; + +create table t2 (it1 tinyint, it2 tinyint not null, i int not null, f float, d double, y year, da date, dt datetime, sc char(10), sv varchar(10), b blob); +insert into t2 values (NULL, 1, 3, 1.5, 2.5, 1972, '1972-10-22', '1972-10-22 11:50', 'testc', 'testv', 'tetetetetest'); + +create table t1 SELECT it2 from t2 UNION select it1 from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT it2 from t2 UNION select i from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT i from t2 UNION select f from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT f from t2 UNION select d from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT f from t2 UNION select y from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT f from t2 UNION select da from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT y from t2 UNION select da from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT y from t2 UNION select dt from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT da from t2 UNION select dt from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT dt from t2 UNION select sc from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT dt from t2 UNION select sv from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT sc from t2 UNION select sv from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT dt from t2 UNION select b from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT sv from t2 UNION select b from t2; +select * from t1; +show create table t1; +drop table t1; +create table t1 SELECT i from t2 UNION select d from t2 UNION select b from t2; +select * from t1; +show create table t1; +drop table t1,t2; |