diff options
author | unknown <bell@sanja.is.com.ua> | 2004-04-08 00:19:43 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-04-08 00:19:43 +0300 |
commit | d5135aff3ad8af11279927185cecda65a6291dd1 (patch) | |
tree | 8623a46473c8c2cb769c792a41b7a28bae698da7 /mysql-test | |
parent | 94002eb59512e78df76922ae5c2204359fc306e4 (diff) | |
parent | c9d856c8b78812dd402b89c62bcea23cc7dbe2a1 (diff) | |
download | mariadb-git-d5135aff3ad8af11279927185cecda65a6291dd1.tar.gz |
merge
sql/item_cmpfunc.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/multi_update.result | 20 | ||||
-rw-r--r-- | mysql-test/t/multi_update.test | 37 |
2 files changed, 54 insertions, 3 deletions
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index fc5ef88f045..f0975b6fa10 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -1,4 +1,5 @@ drop table if exists t1,t2,t3; +drop database if exists mysqltest; create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); create table t3(id3 int not null, t char(12), index(id3)); @@ -402,7 +403,7 @@ DELETE t1 FROM t1, t2 AS t3; DELETE t4 FROM t1, t1 AS t4; DELETE t3 FROM t1 AS t3, t1 AS t4; DELETE t1 FROM t1 AS t3, t2 AS t4; -ERROR 42000: Not unique table/alias: 't1' +ERROR 42S02: Unknown table 't1' in MULTI DELETE INSERT INTO t1 values (1),(2); INSERT INTO t2 values (1),(2); DELETE t1 FROM t1 AS t2, t2 AS t1 where t1.a=t2.a and t1.a=1; @@ -435,3 +436,20 @@ select * from t2; c2_id c2_p_id c2_note c2_active 1 1 A Note 1 drop table t1, t2; +create database mysqltest; +create table mysqltest.t1 (a int, b int, primary key (a)); +create table mysqltest.t2 (a int, b int, primary key (a)); +create table mysqltest.t3 (a int, b int, primary key (a)); +grant select on mysqltest.* to mysqltest_1@localhost; +grant update on mysqltest.t1 to mysqltest_1@localhost; +update t1, t2 set t1.b=1 where t1.a=t2.a; +update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a; +revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; +delete from mysql.user where user='mysqltest_1'; +drop database mysqltest; +create table t1 (a int, primary key (a)); +create table t2 (a int, primary key (a)); +create table t3 (a int, primary key (a)); +delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a); +ERROR 42S02: Unknown table 't3' in MULTI DELETE +drop table t1, t2, t3; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 27fd80e781b..8b6941c4a94 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -4,6 +4,7 @@ --disable_warnings drop table if exists t1,t2,t3; +drop database if exists mysqltest; --enable_warnings create table t1(id1 int not null auto_increment primary key, t char(12)); @@ -354,7 +355,7 @@ CREATE TABLE t2 ( a int ); DELETE t1 FROM t1, t2 AS t3; DELETE t4 FROM t1, t1 AS t4; DELETE t3 FROM t1 AS t3, t1 AS t4; ---error 1066 +--error 1109 DELETE t1 FROM t1 AS t3, t2 AS t4; INSERT INTO t1 values (1),(2); INSERT INTO t2 values (1),(2); @@ -369,7 +370,6 @@ DROP TABLE t1,t2; # # Test update with const tables # - create table `t1` (`p_id` int(10) unsigned NOT NULL auto_increment, `p_code` varchar(20) NOT NULL default '', `p_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`p_id`) ); create table `t2` (`c2_id` int(10) unsigned NULL auto_increment, `c2_p_id` int(10) unsigned NOT NULL default '0', `c2_note` text NOT NULL, `c2_active` tinyint(1) unsigned NOT NULL default '1', PRIMARY KEY (`c2_id`), KEY `c2_p_id` (`c2_p_id`) ); insert into t1 values (0,'A01-Comp',1); @@ -379,3 +379,36 @@ update t1 left join t2 on p_id = c2_p_id set c2_note = 'asdf-1' where p_id = 2; select * from t1; select * from t2; drop table t1, t2; + +# +# prevelege chexk for multiupdate with other tables +# + +connect (root,localhost,root,,test,$MASTER_MYPORT,master.sock); +connection root; +--disable_warnings +create database mysqltest; +--enable_warnings +create table mysqltest.t1 (a int, b int, primary key (a)); +create table mysqltest.t2 (a int, b int, primary key (a)); +create table mysqltest.t3 (a int, b int, primary key (a)); +grant select on mysqltest.* to mysqltest_1@localhost; +grant update on mysqltest.t1 to mysqltest_1@localhost; +connect (user1,localhost,mysqltest_1,,mysqltest,$MASTER_MYPORT,master.sock); +connection user1; +update t1, t2 set t1.b=1 where t1.a=t2.a; +update t1, t2 set t1.b=(select t3.b from t3 where t1.a=t3.a) where t1.a=t2.a; +connection root; +revoke all privileges on mysqltest.t1 from mysqltest_1@localhost; +delete from mysql.user where user='mysqltest_1'; +drop database mysqltest; + +# +# multi delete wrong table check +# +create table t1 (a int, primary key (a)); +create table t2 (a int, primary key (a)); +create table t3 (a int, primary key (a)); +-- error 1109 +delete t1,t3 from t1,t2 where t1.a=t2.a and t2.a=(select t3.a from t3 where t1.a=t3.a); +drop table t1, t2, t3; |