diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2003-08-27 19:11:54 -0400 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2003-08-27 19:11:54 -0400 |
commit | a73058a77c0fe693ea825ab5f9b896fd7eb1bc2c (patch) | |
tree | e6c2943f6ddf76f861bea6ce8b9febe07a60bc95 /mysql-test/t/create.test | |
parent | 6496a0dd14dd15be215cfca5172bad1935302c24 (diff) | |
download | mariadb-git-a73058a77c0fe693ea825ab5f9b896fd7eb1bc2c.tar.gz |
fixed bug #910 (right type of ifnull function)
mysql-test/r/create.result:
added test for bug #910 (right type of ifnull function)
mysql-test/t/create.test:
added test for bug #910 (right type of ifnull function)
sql/field.h:
added new constructors of Field_decimal, Field_tiny, Field_short, Field_float,
Field_null, Field_year
for using in Item::tmp_table_field_from_field_type
sql/item.cc:
added Item::tmp_table_field_from_field_type
sql/item.h:
added Item::tmp_table_field_from_field_type
Diffstat (limited to 'mysql-test/t/create.test')
-rw-r--r-- | mysql-test/t/create.test | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test index 9bc37a0864d..b89cf854ffb 100644 --- a/mysql-test/t/create.test +++ b/mysql-test/t/create.test @@ -215,3 +215,41 @@ CREATE TABLE t1 (a int not null); show create table t1; SET SESSION table_type=default; drop table t1; + +# +# Test types of data for create select with functions +# + +create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob); +insert into t1(a)values(1); +insert into t1(a,b,c,d,e,f,g,h) +values(2,-2,2,'1825-12-14','a','2003-1-1 3:2:1','4:3:2','binary data'); +select * from t1; +select a, + ifnull(b,cast(-7 as signed)) as b, + ifnull(c,cast(7 as unsigned)) as c, + ifnull(d,cast('2000-01-01' as date)) as d, + ifnull(e,cast('b' as char)) as e, + ifnull(f,cast('2000-01-01' as datetime)) as f, + ifnull(g,cast('5:4:3' as time)) as g, + ifnull(h,cast('yet another binary data' as binary)) as h, + addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd +from t1; + +create table t2 +select + a, + ifnull(b,cast(-7 as signed)) as b, + ifnull(c,cast(7 as unsigned)) as c, + ifnull(d,cast('2000-01-01' as date)) as d, + ifnull(e,cast('b' as char)) as e, + ifnull(f,cast('2000-01-01' as datetime)) as f, + ifnull(g,cast('5:4:3' as time)) as g, + ifnull(h,cast('yet another binary data' as binary)) as h, + addtime(cast('1:0:0' as time),cast('1:0:0' as time)) as dd +from t1; +explain t2; + +select * from t2; + +drop table t1, t2; |