summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-10-28 11:02:48 +0300
committerunknown <bell@sanja.is.com.ua>2004-10-28 11:02:48 +0300
commit46ce3d00921491398d2e9a00c2b03e67540dee23 (patch)
tree70b19d638c9beac263179291143f76c5af8757f4 /mysql-test/t
parent93678f6bd9be1d320a63ae3fcf24493dae065ae7 (diff)
parentf41bba8c6156a7adf4c67dfa75e16112767a5d3c (diff)
downloadmariadb-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/t')
-rw-r--r--mysql-test/t/sp-error.test11
-rw-r--r--mysql-test/t/sp-security.test26
-rw-r--r--mysql-test/t/sp.test61
-rw-r--r--mysql-test/t/view.test94
4 files changed, 172 insertions, 20 deletions
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;
+