From 410dd0779c32b1975eceeab92a1e62ff099f37db Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 14 Aug 2001 20:33:49 +0300 Subject: Remove warnings and portability fixes New global read lock code Fixed bug in DATETIME with WHERE optimization Made UNION code more general. include/global.h: Remove warning on Linux Alpha include/mysql_com.h: Move some C variables inside extern "C" block. include/mysqld_error.h: New error mesages myisam/mi_write.c: cleanup mysql-test/r/select.result: Fix because of table lists now always has a database argument. mysql-test/r/type_datetime.result: Test for bug with datetime and where optimization mysql-test/r/union.result: Updated result mysql-test/t/type_datetime.test: New test for datetime mysql-test/t/union.test: More testing of error conditions sql/item_sum.cc: Remove warnings on Linux Alpha sql/item_sum.h: Cleanup sql/lock.cc: Cleaned up global lock handling sql/log_event.cc: Removed default arguments from declarations (not allowed in cxx) sql/mysql_priv.h: New prototypes sql/mysqld.cc: Fix for global locks sql/opt_range.cc: Cleanup sql/share/czech/errmsg.txt: New errors sql/share/danish/errmsg.txt: New errors sql/share/dutch/errmsg.txt: New errors sql/share/english/errmsg.txt: New errors sql/share/estonian/errmsg.txt: New errors sql/share/french/errmsg.txt: New errors sql/share/german/errmsg.txt: New errors sql/share/greek/errmsg.txt: New errors sql/share/hungarian/errmsg.txt: New errors sql/share/italian/errmsg.txt: New errors sql/share/japanese/errmsg.txt: New errors sql/share/korean/errmsg.txt: New errors sql/share/norwegian-ny/errmsg.txt: New errors sql/share/norwegian/errmsg.txt: New errors sql/share/polish/errmsg.txt: New errors sql/share/portuguese/errmsg.txt: New errors sql/share/romanian/errmsg.txt: New errors sql/share/russian/errmsg.txt: New errors sql/share/slovak/errmsg.txt: New errors sql/share/spanish/errmsg.txt: New errors sql/share/swedish/errmsg.OLD: New errors sql/share/swedish/errmsg.txt: New errors sql/sql_acl.cc: Use thd->host_or_ip sql/sql_class.cc: Use new global lock code sql/sql_class.h: host_or_ip sql/sql_db.cc: host_or_ip sql/sql_delete.cc: Use now global lock code sql/sql_lex.h: Cleanup of not used states and variables sql/sql_parse.cc: Use now global locks. Made UNION code more general. Change to use thd->hosts_or_ip. TABLE_LIST now always has 'db' set. sql/sql_repl.cc: Portability fixes. Changed wrong usage of my_vsnprintf -> my_snprintf sql/sql_select.cc: Changes for UNION sql/sql_show.cc: Cleanup sql/sql_union.cc: Handle 'select_result' outside of mysql_union(). sql/sql_yacc.yy: Fixes for union --- mysql-test/r/select.result | 2 +- mysql-test/r/type_datetime.result | 2 ++ mysql-test/r/union.result | 2 -- mysql-test/t/type_datetime.test | 9 +++++++++ mysql-test/t/union.test | 13 ++++++++++++- 5 files changed, 24 insertions(+), 4 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 413b03130f6..33cd9048774 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -1210,7 +1210,7 @@ fld1 fld1 companynr companyname table type possible_keys key key_len ref rows Extra t2 ALL NULL NULL NULL NULL 1199 -t4 eq_ref PRIMARY PRIMARY 1 t2.companynr 1 where used; Not exists +t4 eq_ref PRIMARY PRIMARY 1 test.t2.companynr 1 where used; Not exists table type possible_keys key key_len ref rows Extra t4 ALL NULL NULL NULL NULL 12 t2 ALL NULL NULL NULL NULL 1199 where used; Not exists diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 7028b5ffe33..97365811785 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -33,3 +33,5 @@ date_format(a,"%Y-%m-%d")=b right(a,6)=c+0 a=d+0 1 1 1 a 0000-00-00 00:00:00 +id dt +1 2001-08-14 00:00:00 diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result index a25ea3f4dcd..4e87d9880e5 100644 --- a/mysql-test/r/union.result +++ b/mysql-test/r/union.result @@ -56,5 +56,3 @@ t2 c 1 t2 d 1 t2 e 1 t2 f 1 -table type possible_keys key key_len ref rows Extra -t2 ALL NULL NULL NULL NULL 4 diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test index 1e7bd11bab1..857937fd90e 100644 --- a/mysql-test/t/type_datetime.test +++ b/mysql-test/t/type_datetime.test @@ -30,3 +30,12 @@ CREATE TABLE t1 (a datetime not null); insert into t1 values (0); select * from t1 where a is null; drop table t1; + +# +# Test with bug when propagating DATETIME to integer and WHERE optimization +# + +create table t1 (id int, dt datetime); +insert into t1 values (1,"2001-08-14 00:00:00"),(2,"2001-08-15 00:00:00"),(3,"2001-08-16 00:00:00"); +select * from t1 where dt='2001-08-14 00:00:00' and dt = if(id=1,'2001-08-14 00:00:00','1999-08-15'); +drop table t1; diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test index 36b14fa6bec..d6672185917 100644 --- a/mysql-test/t/union.test +++ b/mysql-test/t/union.test @@ -16,17 +16,28 @@ select 0,'#' union select a,b from t1 union all select a,b from t2 union select select a,b from t1 union select a,b from t1; select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 group by b; +# Test some error conditions with UNION +--error 1215 explain select a,b from t1 union all select a,b from t2; -# Test some error conditions with UNION --error 1215 select a,b from t1 into outfile 'skr' union select a,b from t2; --error 1215 select a,b from t1 order by a union select a,b from t2; +--error 1216 +create table t3 select a,b from t1 union select a from t2; + +--error 1215 +insert into t3 select a from t1 order by a union select a from t2; + --error 1216 select a,b from t1 union select a from t2; + +# Test CREATE, INSERT and REPLACE create table t3 select a,b from t1 union all select a,b from t2; insert into t3 select a,b from t1 union all select a,b from t2; +replace into t3 select a,b as c from t1 union all select a,b from t2; + drop table t1,t2,t3; -- cgit v1.2.1