summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <ibabaev@bk-internal.mysql.com>2007-06-02 00:57:25 +0200
committerunknown <ibabaev@bk-internal.mysql.com>2007-06-02 00:57:25 +0200
commit5697c0c10ceeace7e14f47dd6e9c2d2e0552e78b (patch)
tree5339c6747631cb919dd972d0b8a25a0958bceba5 /mysql-test/t
parent865f294fcfe14bf69a85eb8ba1260b7a4af45d7d (diff)
parente21076463c4c1721bfd7150ff2350d634009755a (diff)
downloadmariadb-git-5697c0c10ceeace7e14f47dd6e9c2d2e0552e78b.tar.gz
Merge bk-internal.mysql.com:/data0/bk/mysql-5.0
into bk-internal.mysql.com:/data0/bk/mysql-5.0-opt mysql-test/r/sp.result: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/strict.test: Auto merged mysql-test/t/subselect3.test: Auto merged sql/mysqld.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_view.cc: Manual merge
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/binlog_killed.test247
-rw-r--r--mysql-test/t/disabled.def4
-rw-r--r--mysql-test/t/grant2.test44
-rw-r--r--mysql-test/t/mysql.test2
-rw-r--r--mysql-test/t/mysqltest.test13
-rw-r--r--mysql-test/t/order_by.test4
-rw-r--r--mysql-test/t/row.test2
-rw-r--r--mysql-test/t/rpl_loaddata.test10
-rw-r--r--mysql-test/t/sp-error.test6
-rw-r--r--mysql-test/t/sp-prelocking.test31
-rw-r--r--mysql-test/t/sp.test2
-rw-r--r--mysql-test/t/strict.test2
-rw-r--r--mysql-test/t/subselect3.test4
-rw-r--r--mysql-test/t/trigger.test4
14 files changed, 350 insertions, 25 deletions
diff --git a/mysql-test/t/binlog_killed.test b/mysql-test/t/binlog_killed.test
new file mode 100644
index 00000000000..1c4f1272691
--- /dev/null
+++ b/mysql-test/t/binlog_killed.test
@@ -0,0 +1,247 @@
+-- source include/have_innodb.inc
+--source include/not_embedded.inc
+
+###
+### bug#22725 : incorrect killed error in binlogged query
+###
+
+connect (con1, localhost, root,,);
+connect (con2, localhost, root,,);
+
+create table t1 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
+create table t2 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=MyISAM;
+create table t3 (a int auto_increment, b int, PRIMARY KEY (a)) ENGINE=InnoDB;
+
+#
+# effective test for bug#22725
+#
+
+connection con1;
+select get_lock("a", 20);
+
+connection con2;
+let $ID= `select connection_id()`;
+reset master;
+send insert into t2 values (null, null), (null, get_lock("a", 10));
+
+
+connection con1;
+
+disable_abort_on_error;
+disable_query_log;
+disable_result_log;
+
+eval kill query $ID;
+
+connection con2;
+--error 0,ER_QUERY_INTERRUPTED
+reap;
+let $rows= `select count(*) from t2 /* must be 2 or 0 */`;
+
+--exec $MYSQL_BINLOG --start-position=126 $MYSQLTEST_VARDIR/log/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval select
+(@a:=load_file("$MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog"))
+is not null;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+let $error_code= `select @a like "%#%error_code=0%" /* must return 1 or 0*/`;
+let $insert_binlogged= `select @a like "%insert into%" /* must return 1 or 0 */`;
+eval set @result= $rows- $error_code - $insert_binlogged;
+
+enable_abort_on_error;
+enable_query_log;
+enable_result_log;
+
+select @result /* must be zero either way */;
+
+# the functions are either *insensitive* to killing or killing can cause
+# strange problmes with the error propagation out of SF's stack
+# Bug#27563, Bug#27565, BUG#24971
+#
+# TODO: use if's block as regression test for the bugs or remove
+#
+if (0)
+{
+delimiter |;
+create function bug27563()
+RETURNS int(11)
+DETERMINISTIC
+begin
+ select get_lock("a", 10) into @a;
+ return 1;
+end|
+delimiter ;|
+
+# the function is sensitive to killing requiring innodb though with wrong client error
+# TO FIX in BUG#27565; TODO: remove --error 1105 afterwards
+delimiter |;
+create function bug27565()
+RETURNS int(11)
+DETERMINISTIC
+begin
+ select a from t1 where a=1 into @a for update;
+ return 1;
+end|
+delimiter ;|
+
+reset master;
+
+
+### ta table case: killing causes rollback
+
+# A. autocommit ON
+connection con1;
+select get_lock("a", 20);
+
+connection con2;
+let $ID= `select connection_id()`;
+send insert into t1 values (bug27563(),1);
+
+connection con1;
+eval kill query $ID;
+
+connection con2;
+# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero
+--enable_info
+# todo: remove 0 return after fixing Bug#27563
+--error 0,ER_QUERY_INTERRUPTED
+reap; ### pb: wrong error
+--disable_info
+###--replace_column 2 # 5 #
+### show binlog events from 98 /* nothing in binlog unless Bug#27563 */;
+show master status /* must be only FD event unless Bug#27563 */;
+select count(*) from t1 /* must be zero unless Bug#27563 */;
+
+# M. multi-statement-ta
+connection con2;
+let $ID= `select connection_id()`;
+begin;
+send insert into t1 values (bug27563(),1);
+
+connection con1;
+eval kill query $ID;
+connection con2;
+# todo (re-record test): after bugs 27563,27565 got fixed affected rows will report zero
+--enable_info
+# todo: remove 0 return after fixing Bug#27563
+--error 0,ER_QUERY_INTERRUPTED
+reap;
+--disable_info
+select count(*) from t1 /* must be zero unless Bug#27563 */;
+commit;
+
+
+### non-ta table case: killing must be recorded in binlog
+
+reset master;
+
+connection con2;
+let $ID= `select connection_id()`;
+send insert into t2 values (bug27563(),1);
+
+connection con1;
+eval kill query $ID;
+
+connection con2;
+# todo: remove 0 return after fixing Bug#27563
+--error 0,ER_QUERY_INTERRUPTED
+reap;
+select count(*) from t2 /* must be one */;
+#show binlog events from 98 /* must have the insert on non-ta table */;
+show master status /* must have the insert event more to FD */;
+# the value of the error flag of KILLED_QUERY is tested further
+
+connection con1;
+select RELEASE_LOCK("a");
+
+### test with effective killing of SF()
+
+delete from t1;
+delete from t2;
+insert into t1 values (1,1);
+insert into t2 values (1,1);
+
+#
+# Bug#27565
+# test where KILL is propagated as error to the top level
+# still another bug with the error message to the user
+# todo: fix reexecute the result file after fixing
+#
+begin; update t1 set b=0 where a=1;
+
+connection con2;
+let $ID= `select connection_id()`;
+send update t2 set b=bug27565()-1 where a=1;
+
+connection con1;
+eval kill query $ID;
+commit;
+
+connection con2;
+# todo: fix Bug #27565 killed query of SF() is not reported correctly and
+# remove 1105 (wrong)
+#--error ER_QUERY_INTERRUPTED
+--error 1105,ER_QUERY_INTERRUPTED
+reap; ### pb: wrong error
+select * from t1 /* must be: (1,0) */;
+select * from t2 /* must be as before: (1,1) */;
+
+## bug#22725 with effective and propagating killing
+#
+# top-level ta-table
+connection con1;
+delete from t3;
+reset master;
+begin; update t1 set b=0 where a=1;
+
+connection con2;
+let $ID= `select connection_id()`;
+# the query won't perform completely since the function gets interrupted
+send insert into t3 values (0,0),(1,bug27565());
+
+connection con1;
+eval kill query $ID;
+rollback;
+
+connection con2;
+# todo: fix Bug #27565 killed query of SF() is not reported correctly and
+# remove 1105 (wrong)
+#--error ER_QUERY_INTERRUPTED
+--error 1105,ER_QUERY_INTERRUPTED
+reap; ### pb: wrong error
+select count(*) from t3 /* must be zero */;
+show master status /* nothing in binlog */;
+
+# top-level non-ta-table
+connection con1;
+delete from t2;
+reset master;
+begin; update t1 set b=0 where a=1;
+
+connection con2;
+let $ID= `select connection_id()`;
+# the query won't perform completely since the function gets intrurrupted
+send insert into t2 values (0,0),(1,bug27565()) /* non-ta t2 */;
+
+connection con1;
+eval kill query $ID;
+rollback;
+
+connection con2;
+# todo: fix Bug #27565 killed query of SF() is not reported correctly and
+# remove 1105 (wrong)
+#--error ER_QUERY_INTERRUPTED
+--error 1105,ER_QUERY_INTERRUPTED
+reap; ### pb: wrong error
+
+select count(*) from t2 /* count must be one */;
+show master status /* insert into non-ta must be in binlog */;
+
+drop function bug27563;
+drop function bug27565;
+}
+
+system rm $MYSQLTEST_VARDIR/tmp/kill_query_calling_sp.binlog ;
+
+drop table t1,t2,t3;
+
diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def
index 85685234de9..9d6a9b57e9a 100644
--- a/mysql-test/t/disabled.def
+++ b/mysql-test/t/disabled.def
@@ -10,7 +10,9 @@
#
##############################################################################
-ndb_load : Bug#17233
user_limits : Bug#23921 random failure of user_limits.test
im_life_cycle : Bug#27851: Instance manager test im_life_cycle fails randomly
im_daemon_life_cycle : Bug#20294: Instance manager tests fail randomly
+im_options_set : Bug#20294: Instance manager tests fail randomly
+im_options_unset : Bug#20294: Instance manager tests fail randomly
+im_utils : Bug#20294: Instance manager tests fail randomly
diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test
index d08a9e3f83d..4a3324b1833 100644
--- a/mysql-test/t/grant2.test
+++ b/mysql-test/t/grant2.test
@@ -513,3 +513,47 @@ disconnect bug13310;
connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
+
+
+#
+# Bug#25578 "CREATE TABLE LIKE does not require any privileges on source table"
+#
+--disable_warnings
+drop database if exists mysqltest_1;
+drop database if exists mysqltest_2;
+--enable_warnings
+--error 0,ER_CANNOT_USER
+drop user mysqltest_u1@localhost;
+
+create database mysqltest_1;
+create database mysqltest_2;
+grant all on mysqltest_1.* to mysqltest_u1@localhost;
+use mysqltest_2;
+create table t1 (i int);
+
+# Connect as user with all rights on mysqltest_1 but with no rights on mysqltest_2.
+connect (user1,localhost,mysqltest_u1,,mysqltest_1);
+connection user1;
+# As expected error is emitted
+--error ER_TABLEACCESS_DENIED_ERROR
+show create table mysqltest_2.t1;
+# This should emit error as well
+--error ER_TABLEACCESS_DENIED_ERROR
+create table t1 like mysqltest_2.t1;
+
+# Now let us check that SELECT privilege on the source is enough
+connection default;
+grant select on mysqltest_2.t1 to mysqltest_u1@localhost;
+connection user1;
+show create table mysqltest_2.t1;
+create table t1 like mysqltest_2.t1;
+
+# Clean-up
+connection default;
+use test;
+drop database mysqltest_1;
+drop database mysqltest_2;
+drop user mysqltest_u1@localhost;
+
+--echo End of 5.0 tests
+
diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test
index 0732559e7e1..37bbca77d9f 100644
--- a/mysql-test/t/mysql.test
+++ b/mysql-test/t/mysql.test
@@ -262,7 +262,7 @@ EOF
--exec $MYSQL test -e "show status" 2>&1 > /dev/null
--exec $MYSQL --help 2>&1 > /dev/null
--exec $MYSQL --version 2>&1 > /dev/null
---enable_quary_log
+--enable_query_log
#
# bug #26851: Mysql Client --pager Buffer Overflow
diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test
index 057432d37fd..54d17df1fd9 100644
--- a/mysql-test/t/mysqltest.test
+++ b/mysql-test/t/mysqltest.test
@@ -46,11 +46,6 @@ select otto from (select 1 as otto) as t1;
--error 0
select otto from (select 1 as otto) as t1;
-# expectation <> response
--- // --error 1054
--- // select otto from (select 1 as otto) as t1;
-
-
# ----------------------------------------------------------------------------
# Negative case(statement):
# The derived table t1 does not contain a column named 'friedrich' .
@@ -331,9 +326,9 @@ select 3 from t1 ;
# This is a comment
# This is a ; comment
# This is a -- comment
--- This is also a comment
--- # This is also a comment
--- This is also a ; comment
+# -- This is also a comment
+# -- # This is also a comment
+# -- This is also a ; comment
# ----------------------------------------------------------------------------
# Test comments with embedded command
@@ -1871,7 +1866,7 @@ DROP TABLE t1;
--disable_query_log
--exec $MYSQL_TEST --help 2>&1 > /dev/null
--exec $MYSQL_TEST --version 2>&1 > /dev/null
---enable_quary_log
+--enable_query_log
--disable_abort_on_error
--error 1
--exec $MYSQL_TEST a b c 2>&1 > /dev/null
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index 3e8fa07dfb7..29a290c7fbf 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -719,10 +719,10 @@ CREATE TABLE t1 (a INT UNSIGNED NOT NULL, b TIME);
INSERT INTO t1 (a) VALUES (100000), (0), (100), (1000000),(10000), (1000), (10);
UPDATE t1 SET b = SEC_TO_TIME(a);
--- Correct ORDER
+# Correct ORDER
SELECT a, b FROM t1 ORDER BY b DESC;
--- must be ordered as the above
+# must be ordered as the above
SELECT a, b FROM t1 ORDER BY SEC_TO_TIME(a) DESC;
DROP TABLE t1;
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index d2750fecbac..20d044306a6 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -7,10 +7,8 @@ select (1,2,3) IN ((3,2,3), (1,2,3), (1,3,3));
select row(10,2,3) IN (row(3,2,3), row(1,2,3), row(1,3,3));
select row(1,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
select row(10,2,3) IN (row(3,NULL,3), row(1,2,3), row(1,3,3));
---disable_ps_warnings
select row('a',1.5,3) IN (row(1,2,3), row('a',1.5,3), row('a','a','a'));
select row('a',0,3) IN (row(3,2,3), row('a','a','3'), row(1,3,3));
---enable_ps_warnings
select row('a',0,3) IN (row(3,2,3), row('a','0','3'), row(1,3,3));
select row('a',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
select row('b',1.5,3) IN (row(3,NULL,3), row('a',1.5,3), row(1,3,3));
diff --git a/mysql-test/t/rpl_loaddata.test b/mysql-test/t/rpl_loaddata.test
index 5ebdec6f761..a4781ed4faa 100644
--- a/mysql-test/t/rpl_loaddata.test
+++ b/mysql-test/t/rpl_loaddata.test
@@ -12,6 +12,7 @@
# Last_slave_errno in SHOW SLAVE STATUS (1st and 3rd commands did not: bug 986)
source include/master-slave.inc;
+source include/have_innodb.inc;
connection slave;
reset master;
@@ -150,5 +151,14 @@ drop table t2;
connection master;
drop table t2;
drop table t1;
+
+# BUG#17233 LOAD DATA INFILE: failure causes mysqld dbug_assert, binlog not flushed
+CREATE TABLE t1 (word CHAR(20) NOT NULL PRIMARY KEY) ENGINE=INNODB;
+
+--error 1062
+LOAD DATA INFILE "../std_data_ln/words.dat" INTO TABLE t1;
+
+DROP TABLE t1;
+
sync_with_master;
# End of 4.1 tests
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index 9e5c795d586..ec91be13ba0 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -1454,7 +1454,7 @@ select bug12329();
# Until we implement proper mechanism for invalidation of PS/SP when table
# or SP's are changed the following statement will fail with 'Table ... was
# not locked' error (this mechanism should be based on the new TDC).
---error 1100
+--error ER_NO_SUCH_TABLE
execute stmt1;
deallocate prepare stmt1;
drop function bug12329;
@@ -1639,13 +1639,13 @@ create trigger t1_ai after insert on t1 for each row insert into t2 values (new.
create view v1 as select * from t1;
drop table t2;
# Limitation, the desired error is ER_VIEW_INVALID
---error ER_TABLE_NOT_LOCKED
+--error ER_NO_SUCH_TABLE
insert into v1 values (1);
drop trigger t1_ai;
create function bug11555_1() returns int return (select max(i) from t2);
create trigger t1_ai after insert on t1 for each row set @a:=bug11555_1();
# Limitation, the desired error is ER_VIEW_INVALID
---error ER_TABLE_NOT_LOCKED
+--error ER_NO_SUCH_TABLE
insert into v1 values (2);
drop function bug11555_1;
drop table t1;
diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test
index cc3e3b93e06..ec5b7fbad7c 100644
--- a/mysql-test/t/sp-prelocking.test
+++ b/mysql-test/t/sp-prelocking.test
@@ -301,5 +301,36 @@ deallocate prepare stmt;
drop function bug19634;
drop table t1, t2, t3;
+#
+# Bug #27907 Misleading error message when opening/locking tables
+#
+
+--disable_warnings
+drop table if exists bug_27907_logs;
+drop table if exists bug_27907_t1;
+--enable_warnings
+
+create table bug_27907_logs (a int);
+create table bug_27907_t1 (a int);
+
+delimiter |;
+
+create trigger bug_27907_t1_ai after insert on bug_27907_t1
+for each row
+begin
+ insert into bug_27907_logs (a) values (1);
+end|
+
+delimiter ;|
+
+drop table bug_27907_logs;
+
+#
+# was failing before with error ER_NOT_LOCKED
+#
+--error ER_NO_SUCH_TABLE
+insert into bug_27907_t1(a) values (1);
+
+drop table bug_27907_t1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 88b8a46c48f..0de416cdffa 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -6975,7 +6975,7 @@ use test|
--disable_warnings
drop function if exists bug20777|
drop table if exists examplebug20777|
---enabled_warnings
+--enable_warnings
create function bug20777(f1 bigint unsigned) returns bigint unsigned
begin
set f1 = (f1 - 10); set f1 = (f1 + 10);
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index bf49a6a906c..2b71bf1093c 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -975,9 +975,7 @@ select * from t1;
# Check that select don't abort even in strict mode (for now)
set sql_mode='traditional';
---disable_ps_warnings
select count(*) from t1 where STR_TO_DATE('2004.12.12 10:22:61','%Y.%m.%d %T') IS NULL;
---enable_ps_warnings
drop table t1;
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index 0302e2cede6..2f844c9cc21 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -260,11 +260,11 @@ insert into t2 values
('dd', 1, NULL);
alter table t1 add index idx(ie1,ie2);
---cc 3 NULL NULL
+# cc 3 NULL NULL
select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=3 and b is null ;
insert into t2 values ('new1', 10,10);
insert into t1 values ('new1', 1234, 10, NULL);
--- new1, 10, 10, NULL,
+# new1, 10, 10, NULL,
select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10;
explain extended
select oref, a, b, (a,b) in (select ie1,ie2 from t1 where oref=t2.oref) Z from t2 where a=10 and b=10;
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 82de4dac111..43a582439fb 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -1000,9 +1000,9 @@ create trigger t1_bi after insert on t1 for each row insert into t3 values (new.
# Until we implement proper mechanism for invalidation of PS/SP when table
# or SP's are changed these two statements will fail with 'Table ... was
# not locked' error (this mechanism should be based on the new TDC).
---error 1100 #ER_TABLE_NOT_LOCKED
+--error ER_NO_SUCH_TABLE
execute stmt1;
---error 1100 #ER_TABLE_NOT_LOCKED
+--error ER_NO_SUCH_TABLE
call p1();
deallocate prepare stmt1;
drop procedure p1;