diff options
author | unknown <bell@sanja.is.com.ua> | 2004-10-28 11:02:48 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-10-28 11:02:48 +0300 |
commit | 46ce3d00921491398d2e9a00c2b03e67540dee23 (patch) | |
tree | 70b19d638c9beac263179291143f76c5af8757f4 /mysql-test | |
parent | 93678f6bd9be1d320a63ae3fcf24493dae065ae7 (diff) | |
parent | f41bba8c6156a7adf4c67dfa75e16112767a5d3c (diff) | |
download | mariadb-git-46ce3d00921491398d2e9a00c2b03e67540dee23.tar.gz |
merge
mysql-test/r/sp-security.result:
Auto merged
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp-security.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/log_event.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_rcontext.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/func_str.result | 6 | ||||
-rw-r--r-- | mysql-test/r/rpl_auto_increment.result | 2 | ||||
-rw-r--r-- | mysql-test/r/sp-error.result | 11 | ||||
-rw-r--r-- | mysql-test/r/sp-security.result | 11 | ||||
-rw-r--r-- | mysql-test/r/sp.result | 57 | ||||
-rw-r--r-- | mysql-test/r/view.result | 115 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 11 | ||||
-rw-r--r-- | mysql-test/t/sp-security.test | 26 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 61 | ||||
-rw-r--r-- | mysql-test/t/view.test | 94 |
10 files changed, 340 insertions, 54 deletions
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result index 400d79be835..ede91e9c376 100644 --- a/mysql-test/r/func_str.result +++ b/mysql-test/r/func_str.result @@ -395,9 +395,9 @@ select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2); SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin1'd',2) abcdabc select SUBSTRING_INDEX(_latin1'abcdabcdabcd',_latin2'd',2); -ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'substr_index' +ERROR HY000: Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (latin2_general_ci,COERCIBLE) for operation 'substring_index' select SUBSTRING_INDEX(_latin1'abcdabcdabcd' COLLATE latin1_general_ci,_latin1'd' COLLATE latin1_bin,2); -ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substr_index' +ERROR HY000: Illegal mix of collations (latin1_general_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'substring_index' select _latin1'B' between _latin1'a' and _latin1'c'; _latin1'B' between _latin1'a' and _latin1'c' 1 @@ -638,7 +638,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")` +Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,cast(_latin1'HE' as char charset binary) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substring_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")` SELECT lpad(12345, 5, "#"); lpad(12345, 5, "#") 12345 diff --git a/mysql-test/r/rpl_auto_increment.result b/mysql-test/r/rpl_auto_increment.result index 4a925163060..0746f4c47a7 100644 --- a/mysql-test/r/rpl_auto_increment.result +++ b/mysql-test/r/rpl_auto_increment.result @@ -39,7 +39,7 @@ drop table t1; set @@session.auto_increment_increment=100, @@session.auto_increment_offset=10; show variables like "%auto%"; Variable_name Value -auto_incrememt_increment 100 +auto_increment_increment 100 auto_increment_offset 10 create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; insert into t1 values (NULL),(5),(NULL); diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 0a679957e44..9bea0fe0d4c 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -115,14 +115,6 @@ foo: loop set @x=2; end loop bar| ERROR 42000: End-label bar without match -create procedure foo(out x int) -begin -declare y int; -set x = y; -end| -Warnings: -Warning 1311 Referring to uninitialized variable y -drop procedure foo| create procedure foo() return 42| ERROR 42000: RETURN is only allowed in a FUNCTION @@ -235,9 +227,6 @@ ERROR 24000: Cursor is not open drop procedure p| alter procedure bar3 sql security invoker| ERROR 42000: PROCEDURE test.bar3 does not exist -alter procedure bar3 name -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA| -ERROR 42000: Identifier name 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' is too long drop table t1| drop table if exists t1| create table t1 (val int, x float)| diff --git a/mysql-test/r/sp-security.result b/mysql-test/r/sp-security.result index f5e74733bc5..25582796812 100644 --- a/mysql-test/r/sp-security.result +++ b/mysql-test/r/sp-security.result @@ -107,13 +107,20 @@ s1 0 2 2 +alter procedure p modifies sql data; +drop procedure p; +alter procedure q modifies sql data; +ERROR 42000: Access denied; you are not the procedure/function definer of 'db2.q' +drop procedure q; +ERROR 42000: Access denied; you are not the procedure/function definer of 'db2.q' +use db2; +alter procedure q modifies sql data; +drop procedure q; use test; select type,db,name from mysql.proc; type db name FUNCTION db1_secret db PROCEDURE db1_secret stamp -PROCEDURE db2 p -PROCEDURE db2 q drop database db1_secret; drop database db2; select type,db,name from mysql.proc; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 80fa0c6ffc9..4880b545ebe 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -893,15 +893,15 @@ select * from t1| id data chistics 1 delete from t1| -alter procedure chistics sql security invoker name chistics2| -show create procedure chistics2| +alter procedure chistics sql security invoker| +show create procedure chistics| Procedure sql_mode Create Procedure -chistics2 CREATE PROCEDURE `test`.`chistics2`() +chistics CREATE PROCEDURE `test`.`chistics`() MODIFIES SQL DATA SQL SECURITY INVOKER COMMENT 'Characteristics procedure test' insert into t1 values ("chistics", 1) -drop procedure chistics2| +drop procedure chistics| create function chistics() returns int language sql deterministic @@ -918,18 +918,18 @@ return 42 select chistics()| chistics() 42 -alter function chistics name chistics2 +alter function chistics no sql comment 'Characteristics function test'| -show create function chistics2| +show create function chistics| Function sql_mode Create Function -chistics2 CREATE FUNCTION `test`.`chistics2`() RETURNS int +chistics CREATE FUNCTION `test`.`chistics`() RETURNS int NO SQL DETERMINISTIC SQL SECURITY INVOKER COMMENT 'Characteristics function test' return 42 -drop function chistics2| +drop function chistics| insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)| set @@sql_mode = 'ANSI'| create procedure modes(out c1 int, out c2 int) @@ -1853,13 +1853,9 @@ begin declare v char; return v; end| -Warnings: -Warning 1311 Referring to uninitialized variable v select bug4487()| bug4487() NULL -Warnings: -Warning 1311 Referring to uninitialized variable v drop function bug4487| drop procedure if exists bug4941| create procedure bug4941(out x int) @@ -1948,6 +1944,39 @@ s1 1 drop procedure bug4905| drop table t3| +drop function if exists bug6022| +create function bug6022(x int) returns int +begin +if x < 0 then +return 0; +else +return bug6022(x-1); +end if; +end| +select bug6022(5)| +bug6022(5) +0 +drop function bug6022| +drop procedure if exists bug6029| +create procedure bug6029() +begin +declare exit handler for 1136 select '1136'; +declare exit handler for sqlstate '23000' select 'sqlstate 23000'; +declare continue handler for sqlexception select 'sqlexception'; +insert into t3 values (1); +insert into t3 values (1,2); +end| +create table t3 (s1 int, primary key (s1))| +insert into t3 values (1)| +call bug6029()| +sqlstate 23000 +sqlstate 23000 +delete from t3| +call bug6029()| +1136 +1136 +drop procedure bug6029| +drop table t3| drop table if exists fac| create table fac (n int unsigned not null primary key, f bigint unsigned)| create procedure ifac(n int unsigned) @@ -2146,8 +2175,8 @@ insert into test.t1 values (x, y)| show procedure status like 'bar'| Db Name Type Definer Modified Created Security_type Comment test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 INVOKER 111111111111 -alter procedure bar name bar2 comment "2222222222" sql security definer| -alter procedure bar2 name bar comment "3333333333"| +alter procedure bar comment "2222222222" sql security definer| +alter procedure bar comment "3333333333"| alter procedure bar| show create procedure bar| Procedure sql_mode Create Procedure diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index a401a56aa34..3f12a582868 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -991,8 +991,6 @@ drop view v1; create view v1 (a,a) as select 'a','a'; ERROR 42S21: Duplicate column name 'a' create procedure p1 () begin declare v int; create view v1 as select v; end;// -Warnings: -Warning 1311 Referring to uninitialized variable v call p1(); ERROR HY000: View's SELECT contains a variable or parameter drop procedure p1; @@ -1467,7 +1465,7 @@ v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` alter algorithm=undefined view v1 as select * from t1 with check option; show create view v1; View Create View -v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1` WITH LOCAL CHECK OPTION +v1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`v1` AS select `test`.`t1`.`a` AS `a` from `test`.`t1` WITH CASCADED CHECK OPTION alter algorithm=merge view v1 as select * from t1 with cascaded check option; show create view v1; View Create View @@ -1517,3 +1515,114 @@ s1 deallocate prepare stmt1; drop view v2; drop table t1, t2; +create table t1 (t time); +create view v1 as select substring_index(t,':',2) as t from t1; +insert into t1 (t) values ('12:24:10'); +select substring_index(t,':',2) from t1; +substring_index(t,':',2) +12:24 +select substring_index(t,':',2) from v1; +substring_index(t,':',2) +12:24 +drop view v1; +drop table t1; +create table t1 (s1 tinyint); +create view v1 as select * from t1 where s1 <> 0 with local check option; +create view v2 as select * from v1 with cascaded check option; +insert into v2 values (0); +ERROR HY000: CHECK OPTION failed 'test.v2' +drop view v2, v1; +drop table t1; +create table t1 (s1 int); +create view v1 as select * from t1 where s1 < 5 with check option; +insert ignore into v1 values (6); +ERROR HY000: CHECK OPTION failed 'test.v1' +insert ignore into v1 values (6),(3); +Warnings: +Error 1369 CHECK OPTION failed 'test.v1' +select * from t1; +s1 +3 +drop view v1; +drop table t1; +create table t1 (s1 tinyint); +create trigger t1_bi before insert on t1 for each row set new.s1 = 500; +create view v1 as select * from t1 where s1 <> 127 with check option; +insert into v1 values (0); +ERROR HY000: CHECK OPTION failed 'test.v1' +select * from v1; +s1 +select * from t1; +s1 +drop trigger t1.t1_bi; +drop view v1; +drop table t1; +create table t1 (s1 tinyint); +create view v1 as select * from t1 where s1 <> 0; +create view v2 as select * from v1 where s1 <> 1 with cascaded check option; +insert into v2 values (0); +ERROR HY000: CHECK OPTION failed 'test.v2' +select * from v2; +s1 +select * from t1; +s1 +drop view v2, v1; +drop table t1; +create table t1 (a int, b char(10)); +create view v1 as select * from t1 where a != 0 with check option; +load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines; +ERROR HY000: CHECK OPTION failed 'test.v1' +select * from t1; +a b +1 row 1 +2 row 2 +select * from v1; +a b +1 row 1 +2 row 2 +delete from t1; +load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; +Warnings: +Warning 1264 Out of range value adjusted for column 'a' at row 3 +Error 1369 CHECK OPTION failed 'test.v1' +Warning 1264 Out of range value adjusted for column 'a' at row 4 +Error 1369 CHECK OPTION failed 'test.v1' +select * from t1; +a b +1 row 1 +2 row 2 +3 row 3 +select * from v1; +a b +1 row 1 +2 row 2 +3 row 3 +drop view v1; +drop table t1; +create table t1 (a text, b text); +create view v1 as select * from t1 where a <> 'Field A' with check option; +load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by ''''; +ERROR HY000: CHECK OPTION failed 'test.v1' +select concat('|',a,'|'), concat('|',b,'|') from t1; +concat('|',a,'|') concat('|',b,'|') +select concat('|',a,'|'), concat('|',b,'|') from v1; +concat('|',a,'|') concat('|',b,'|') +delete from t1; +load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by ''''; +Warnings: +Error 1369 CHECK OPTION failed 'test.v1' +Warning 1261 Row 2 doesn't contain data for all columns +select concat('|',a,'|'), concat('|',b,'|') from t1; +concat('|',a,'|') concat('|',b,'|') +|Field 1| |Field 2' +Field 3,'Field 4| +|Field 5' ,'Field 6| NULL +|Field 6| | 'Field 7'| +select concat('|',a,'|'), concat('|',b,'|') from v1; +concat('|',a,'|') concat('|',b,'|') +|Field 1| |Field 2' +Field 3,'Field 4| +|Field 5' ,'Field 6| NULL +|Field 6| | 'Field 7'| +drop view v1; +drop table t1; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 6970523ad31..08c8c7788ce 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -156,14 +156,6 @@ foo: loop set @x=2; end loop bar| -# Referring to undef variable -create procedure foo(out x int) -begin - declare y int; - set x = y; -end| -drop procedure foo| - # RETURN in FUNCTION only --error 1313 create procedure foo() @@ -307,9 +299,6 @@ drop procedure p| --error 1305 alter procedure bar3 sql security invoker| ---error 1059 -alter procedure bar3 name -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA| drop table t1| diff --git a/mysql-test/t/sp-security.test b/mysql-test/t/sp-security.test index 2089d311fd3..d1119499cf1 100644 --- a/mysql-test/t/sp-security.test +++ b/mysql-test/t/sp-security.test @@ -180,8 +180,32 @@ use db2; call q(); select * from t2; -# Clean up + +# +# BUG#6030: Stored procedure has no appropriate DROP privilege +# (or ALTER for that matter) + +# still connection con2user1 in db2 + +# This should work: +alter procedure p modifies sql data; +drop procedure p; + +# This should NOT work +--error 1370 +alter procedure q modifies sql data; +--error 1370 +drop procedure q; + connection con1root; +use db2; +# But root always can +alter procedure q modifies sql data; +drop procedure q; + + +# Clean up +#Still connection con1root; use test; select type,db,name from mysql.proc; drop database db1_secret; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 6d1e2a171da..79c9c7097c6 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -990,9 +990,9 @@ show create procedure chistics| call chistics()| select * from t1| delete from t1| -alter procedure chistics sql security invoker name chistics2| -show create procedure chistics2| -drop procedure chistics2| +alter procedure chistics sql security invoker| +show create procedure chistics| +drop procedure chistics| create function chistics() returns int language sql @@ -1004,11 +1004,11 @@ create function chistics() returns int show create function chistics| # Call it, just to make sure. select chistics()| -alter function chistics name chistics2 +alter function chistics no sql comment 'Characteristics function test'| -show create function chistics2| -drop function chistics2| +show create function chistics| +drop function chistics| # Check mode settings @@ -2105,6 +2105,51 @@ select * from t3| drop procedure bug4905| drop table t3| +# +# BUG#6022: Stored procedure shutdown problem with self-calling function. +# +--disable_warnings +drop function if exists bug6022| +--enable_warnings + +create function bug6022(x int) returns int +begin + if x < 0 then + return 0; + else + return bug6022(x-1); + end if; +end| + +select bug6022(5)| +drop function bug6022| + +# +# BUG#6029: Stored procedure specific handlers should have priority +# +--disable_warnings +drop procedure if exists bug6029| +--enable_warnings + +create procedure bug6029() +begin + declare exit handler for 1136 select '1136'; + declare exit handler for sqlstate '23000' select 'sqlstate 23000'; + declare continue handler for sqlexception select 'sqlexception'; + + insert into t3 values (1); + insert into t3 values (1,2); +end| + +create table t3 (s1 int, primary key (s1))| +insert into t3 values (1)| +call bug6029()| +delete from t3| +call bug6029()| + +drop procedure bug6029| +drop table t3| + # # Some "real" examples @@ -2283,8 +2328,8 @@ create procedure bar(x char(16), y int) insert into test.t1 values (x, y)| --replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' show procedure status like 'bar'| -alter procedure bar name bar2 comment "2222222222" sql security definer| -alter procedure bar2 name bar comment "3333333333"| +alter procedure bar comment "2222222222" sql security definer| +alter procedure bar comment "3333333333"| alter procedure bar| show create procedure bar| --replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index d8d49fd038e..8e38b5616f8 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -1460,3 +1460,97 @@ execute stmt1; deallocate prepare stmt1; drop view v2; drop table t1, t2; + +# +# test of substring_index with view +# +create table t1 (t time); +create view v1 as select substring_index(t,':',2) as t from t1; +insert into t1 (t) values ('12:24:10'); +select substring_index(t,':',2) from t1; +select substring_index(t,':',2) from v1; +drop view v1; +drop table t1; + +# +# test of cascaded check option for whiew without WHERE clause +# +create table t1 (s1 tinyint); +create view v1 as select * from t1 where s1 <> 0 with local check option; +create view v2 as select * from v1 with cascaded check option; +-- error 1369 +insert into v2 values (0); +drop view v2, v1; +drop table t1; + +# +# inserting single value with check option failed always get error +# +create table t1 (s1 int); +create view v1 as select * from t1 where s1 < 5 with check option; +#single value +-- error 1369 +insert ignore into v1 values (6); +#several values +insert ignore into v1 values (6),(3); +select * from t1; +drop view v1; +drop table t1; + +# +# changing value by trigger and CHECK OPTION +# +create table t1 (s1 tinyint); +create trigger t1_bi before insert on t1 for each row set new.s1 = 500; +create view v1 as select * from t1 where s1 <> 127 with check option; +-- error 1369 +insert into v1 values (0); +select * from v1; +select * from t1; +drop trigger t1.t1_bi; +drop view v1; +drop table t1; + +# +# CASCADED should be used for all underlaying VIEWs +# +create table t1 (s1 tinyint); +create view v1 as select * from t1 where s1 <> 0; +create view v2 as select * from v1 where s1 <> 1 with cascaded check option; +-- error 1369 +insert into v2 values (0); +select * from v2; +select * from t1; +drop view v2, v1; +drop table t1; + +# +# LOAD DATA with view and CHECK OPTION +# +# fixed length fields +create table t1 (a int, b char(10)); +create view v1 as select * from t1 where a != 0 with check option; +-- error 1369 +load data infile '../../std_data/loaddata3.dat' into table v1 fields terminated by '' enclosed by '' ignore 1 lines; +select * from t1; +select * from v1; +delete from t1; +load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields terminated by '' enclosed by '' ignore 1 lines; +select * from t1; +select * from v1; +drop view v1; +drop table t1; +# variable length fields +create table t1 (a text, b text); +create view v1 as select * from t1 where a <> 'Field A' with check option; +-- error 1369 +load data infile '../../std_data/loaddata2.dat' into table v1 fields terminated by ',' enclosed by ''''; +select concat('|',a,'|'), concat('|',b,'|') from t1; +select concat('|',a,'|'), concat('|',b,'|') from v1; +delete from t1; +load data infile '../../std_data/loaddata2.dat' ignore into table v1 fields terminated by ',' enclosed by ''''; +select concat('|',a,'|'), concat('|',b,'|') from t1; +select concat('|',a,'|'), concat('|',b,'|') from v1; +drop view v1; +drop table t1; + |