summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <kostja@vajra.(none)>2007-05-24 19:23:52 +0400
committerunknown <kostja@vajra.(none)>2007-05-24 19:23:52 +0400
commitc8236f564c3e7fc5e12efb108e8b378a455290aa (patch)
tree2aabe5fa8318146f9e0c470b21d49e3cdf39338d /mysql-test
parent351abe5a893d3ae2a0fe004f4a7d73cdd4e9ae14 (diff)
parentf9d7642e7b46d911cda5512ac0bcb55dd85dcd95 (diff)
downloadmariadb-git-c8236f564c3e7fc5e12efb108e8b378a455290aa.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into vajra.(none):/opt/local/work/mysql-5.0-runtime sql/mysql_priv.h: Auto merged sql/sql_base.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/grant2.result24
-rw-r--r--mysql-test/r/sp-error.result6
-rw-r--r--mysql-test/r/sp-prelocking.result13
-rw-r--r--mysql-test/r/trigger.result4
-rw-r--r--mysql-test/t/grant2.test44
-rw-r--r--mysql-test/t/sp-error.test6
-rw-r--r--mysql-test/t/sp-prelocking.test31
-rw-r--r--mysql-test/t/trigger.test4
8 files changed, 122 insertions, 10 deletions
diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result
index ff9b7bc6f1f..93098e68070 100644
--- a/mysql-test/r/grant2.result
+++ b/mysql-test/r/grant2.result
@@ -380,3 +380,27 @@ drop function f2;
drop table t2;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM `a@`@localhost;
drop user `a@`@localhost;
+drop database if exists mysqltest_1;
+drop database if exists mysqltest_2;
+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);
+show create table mysqltest_2.t1;
+ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
+create table t1 like mysqltest_2.t1;
+ERROR 42000: SELECT command denied to user 'mysqltest_u1'@'localhost' for table 't1'
+grant select on mysqltest_2.t1 to mysqltest_u1@localhost;
+show create table mysqltest_2.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `i` int(11) default NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create table t1 like mysqltest_2.t1;
+use test;
+drop database mysqltest_1;
+drop database mysqltest_2;
+drop user mysqltest_u1@localhost;
+End of 5.0 tests
diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result
index bdcb51c4db8..7a2f812cde4 100644
--- a/mysql-test/r/sp-error.result
+++ b/mysql-test/r/sp-error.result
@@ -1030,7 +1030,7 @@ select bug12329();
bug12329()
101
execute stmt1;
-ERROR HY000: Table 't2' was not locked with LOCK TABLES
+ERROR 42S02: Table 'test.t2' doesn't exist
deallocate prepare stmt1;
drop function bug12329;
drop table t1, t2;
@@ -1152,12 +1152,12 @@ 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;
insert into v1 values (1);
-ERROR HY000: Table 't2' was not locked with LOCK TABLES
+ERROR 42S02: Table 'test.t2' doesn't exist
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();
insert into v1 values (2);
-ERROR HY000: Table 't2' was not locked with LOCK TABLES
+ERROR 42S02: Table 'test.t2' doesn't exist
drop function bug11555_1;
drop table t1;
drop view v1;
diff --git a/mysql-test/r/sp-prelocking.result b/mysql-test/r/sp-prelocking.result
index 7d8dd862748..5eac54803f0 100644
--- a/mysql-test/r/sp-prelocking.result
+++ b/mysql-test/r/sp-prelocking.result
@@ -254,4 +254,17 @@ execute stmt;
deallocate prepare stmt;
drop function bug19634;
drop table t1, t2, t3;
+drop table if exists bug_27907_logs;
+drop table if exists bug_27907_t1;
+create table bug_27907_logs (a int);
+create table bug_27907_t1 (a int);
+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|
+drop table bug_27907_logs;
+insert into bug_27907_t1(a) values (1);
+ERROR 42S02: Table 'test.bug_27907_logs' doesn't exist
+drop table bug_27907_t1;
End of 5.0 tests
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 3e6a901dc00..196a990c673 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -820,9 +820,9 @@ call p1();
drop trigger t1_bi;
create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id);
execute stmt1;
-ERROR HY000: Table 't3' was not locked with LOCK TABLES
+ERROR 42S02: Table 'test.t3' doesn't exist
call p1();
-ERROR HY000: Table 't3' was not locked with LOCK TABLES
+ERROR 42S02: Table 'test.t3' doesn't exist
deallocate prepare stmt1;
drop procedure p1;
drop table t1, t2, t3;
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/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/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;