summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <evgen@sunlight.local>2007-09-24 17:23:40 +0400
committerunknown <evgen@sunlight.local>2007-09-24 17:23:40 +0400
commite4cbbcf8a970b854bfbc34f77571afdb0b247814 (patch)
treedff8e299e24252baed98de65a5a6435bbbfcf1c4 /mysql-test/t
parentc2c760bdb60eaa22165b518c209381010d489604 (diff)
parent17df0d648ca86d7074805228ba50d0f137b486d4 (diff)
downloadmariadb-git-e4cbbcf8a970b854bfbc34f77571afdb0b247814.tar.gz
Merge sunlight.local:/local_work/27216-bug-5.0-opt-mysql
into sunlight.local:/local_work/merge-5.1-opt-mysql libmysql/libmysql.c: Auto merged mysql-test/r/date_formats.result: Auto merged mysql-test/r/insert_select.result: Auto merged mysql-test/t/insert_select.test: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_timefunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/protocol.cc: Auto merged sql/sql_class.h: Auto merged mysql-test/r/type_datetime.result: Manually merged mysql-test/t/type_datetime.test: Manually merged sql/item_cmpfunc.cc: Manually merged sql/item_cmpfunc.h: Manually merged sql/sql_insert.cc: Manually merged
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/insert_select.test12
-rw-r--r--mysql-test/t/type_datetime.test37
2 files changed, 49 insertions, 0 deletions
diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test
index ace51ef61c7..499db086877 100644
--- a/mysql-test/t/insert_select.test
+++ b/mysql-test/t/insert_select.test
@@ -372,3 +372,15 @@ INSERT INTO t1 (prev_id) SELECT id
SELECT * FROM t1;
DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug#30384: Having SQL_BUFFER_RESULT option in the
+--echo # CREATE .. KEY(..) .. SELECT led to creating corrupted index.
+--echo #
+create table t1(f1 int);
+insert into t1 values(1),(2),(3);
+create table t2 (key(f1)) engine=myisam select sql_buffer_result f1 from t1;
+check table t2 extended;
+drop table t1,t2;
+--echo ##################################################################
+
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index d8d137d81e6..961b052c039 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -283,6 +283,43 @@ select * from t1 where f1 between 2002010 and 20070101000000;
select * from t1 where f1 between 20020101 and 2007010100000;
drop table t1;
+--echo #
+--echo # Bug#27216: functions with parameters of different date types may
+--echo # return wrong type of the result.
+--echo #
+create table t1 (f1 date, f2 datetime, f3 varchar(20));
+create table t2 as select coalesce(f1,f1) as f4 from t1;
+desc t2;
+create table t3 as select coalesce(f1,f2) as f4 from t1;
+desc t3;
+create table t4 as select coalesce(f2,f2) as f4 from t1;
+desc t4;
+create table t5 as select coalesce(f1,f3) as f4 from t1;
+desc t5;
+create table t6 as select coalesce(f2,f3) as f4 from t1;
+desc t6;
+create table t7 as select coalesce(makedate(1997,1),f2) as f4 from t1;
+desc t7;
+create table t8 as select coalesce(cast('01-01-01' as datetime),f2) as f4
+ from t1;
+desc t8;
+create table t9 as select case when 1 then cast('01-01-01' as date)
+ when 0 then cast('01-01-01' as date) end as f4 from t1;
+desc t9;
+create table t10 as select case when 1 then cast('01-01-01' as datetime)
+ when 0 then cast('01-01-01' as datetime) end as f4 from t1;
+desc t10;
+create table t11 as select if(1, cast('01-01-01' as datetime),
+ cast('01-01-01' as date)) as f4 from t1;
+desc t11;
+create table t12 as select least(cast('01-01-01' as datetime),
+ cast('01-01-01' as date)) as f4 from t1;
+desc t12;
+create table t13 as select ifnull(cast('01-01-01' as datetime),
+ cast('01-01-01' as date)) as f4 from t1;
+desc t13;
+drop tables t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13;
+--echo ###################################################################
#
# Test of storing datetime into date fields
#