summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp-error.test
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2005-12-07 14:38:20 +0300
committerunknown <dlenev@mysql.com>2005-12-07 14:38:20 +0300
commita2023cf0189f0d81d7dd3eac7fd5c46b51234d05 (patch)
treea0edf8c8fbc1b2e79c4a68930d944080cddfe65c /mysql-test/t/sp-error.test
parent6cf8483dfe3da5de4438dc67ccf1ad048e3d1bc8 (diff)
parent24af7680d4fe70ecb359de6b435d76157efaf98a (diff)
downloadmariadb-git-a2023cf0189f0d81d7dd3eac7fd5c46b51234d05.tar.gz
Merge mysqldev@production.mysql.com:my/mysql-5.0-release
into mysql.com:/home/dlenev/src/mysql-5.0-bg11555-2 mysql-test/r/view.result: Auto merged mysql-test/t/sp-error.test: Auto merged sql/sp_head.cc: Auto merged mysql-test/r/sp-error.result: SCCS merged
Diffstat (limited to 'mysql-test/t/sp-error.test')
-rw-r--r--mysql-test/t/sp-error.test61
1 files changed, 61 insertions, 0 deletions
diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test
index b6c7d5476e7..cf8f8dfc79c 100644
--- a/mysql-test/t/sp-error.test
+++ b/mysql-test/t/sp-error.test
@@ -1556,6 +1556,67 @@ drop procedure bug13012_1|
drop function bug13012_2|
delimiter ;|
+# BUG#11555 "Stored procedures: current SP tables locking make
+# impossible view security". We should not expose names of tables
+# which are implicitly used by view (via stored routines/triggers).
+#
+# Note that SQL standard assumes that you simply won't be able drop table
+# and leave some objects (routines/views/triggers) which were depending on
+# it. Such objects should be dropped in advance (by default) or will be
+# dropped simultaneously with table (DROP TABLE with CASCADE clause).
+# So these tests probably should go away once we will implement standard
+# behavior.
+--disable_warnings
+drop function if exists bug11555_1;
+drop function if exists bug11555_2;
+drop view if exists v1, v2, v3, v4;
+--enable_warnings
+create function bug11555_1() returns int return (select max(i) from t1);
+create function bug11555_2() returns int return bug11555_1();
+# It is OK to report name of implicitly used table which is missing
+# when we create view.
+--error ER_NO_SUCH_TABLE
+create view v1 as select bug11555_1();
+--error ER_NO_SUCH_TABLE
+create view v2 as select bug11555_2();
+# But we should hide name of missing implicitly used table when we use view
+create table t1 (i int);
+create view v1 as select bug11555_1();
+create view v2 as select bug11555_2();
+create view v3 as select * from v1;
+drop table t1;
+--error ER_VIEW_INVALID
+select * from v1;
+--error ER_VIEW_INVALID
+select * from v2;
+--error ER_VIEW_INVALID
+select * from v3;
+# Note that creation of view which depends on broken view is yet
+# another form of view usage.
+--error ER_VIEW_INVALID
+create view v4 as select * from v1;
+drop view v1, v2, v3;
+# We also should hide details about broken triggers which are
+# invoked for view.
+drop function bug11555_1;
+drop function bug11555_2;
+create table t1 (i int);
+create table t2 (i int);
+create trigger t1_ai after insert on t1 for each row insert into t2 values (new.i);
+create view v1 as select * from t1;
+drop table t2;
+--error ER_VIEW_INVALID
+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();
+--error ER_VIEW_INVALID
+insert into v1 values (2);
+drop function bug11555_1;
+drop table t1;
+drop view v1;
+
+
# BUG#NNNN: New bug synopsis
#
#--disable_warnings