mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/dlenev/src/mysql-5.0-bg11555-2 mysql-test/r/sp-error.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/t/view.test: Auto merged sql/sp_head.cc: Auto merged sql/sql_trigger.h: Auto merged sql/sp.cc: Manual merge. sql/sp.h: Manual merge. sql/sql_base.cc: Manual merge.
This commit is contained in:
@@ -1055,3 +1055,43 @@ Db Name Type Definer Modified Created Security_type Comment
|
||||
mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
drop database mysqltest2;
|
||||
use test;
|
||||
drop function if exists bug11555_1;
|
||||
drop function if exists bug11555_2;
|
||||
drop view if exists v1, v2, v3, v4;
|
||||
create function bug11555_1() returns int return (select max(i) from t1);
|
||||
create function bug11555_2() returns int return bug11555_1();
|
||||
create view v1 as select bug11555_1();
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
create view v2 as select bug11555_2();
|
||||
ERROR 42S02: Table 'test.t1' doesn't exist
|
||||
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;
|
||||
select * from v1;
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
select * from v2;
|
||||
ERROR HY000: View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
select * from v3;
|
||||
ERROR HY000: View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
create view v4 as select * from v1;
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
drop view v1, v2, v3;
|
||||
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;
|
||||
insert into v1 values (1);
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
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: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
drop function bug11555_1;
|
||||
drop table t1;
|
||||
drop view v1;
|
||||
|
@@ -1933,11 +1933,11 @@ create function f1 () returns int return (select max(col1) from t1);
|
||||
DROP TABLE t1;
|
||||
CHECK TABLE v1, v2, v3, v4, v5, v6;
|
||||
Table Op Msg_type Msg_text
|
||||
test.v1 check error Table 'test.t1' doesn't exist
|
||||
test.v1 check error View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
test.v2 check status OK
|
||||
test.v3 check error Table 'test.t1' doesn't exist
|
||||
test.v3 check error View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
test.v4 check status OK
|
||||
test.v5 check error Table 'test.t1' doesn't exist
|
||||
test.v5 check error View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
test.v6 check status OK
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
|
@@ -1519,6 +1519,67 @@ drop database mysqltest2;
|
||||
use test;
|
||||
|
||||
|
||||
# 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
|
||||
|
@@ -1744,7 +1744,6 @@ drop function f1;
|
||||
CHECK TABLE v1, v2, v3, v4, v5, v6;
|
||||
create function f1 () returns int return (select max(col1) from t1);
|
||||
DROP TABLE t1;
|
||||
# following will show underlying table until BUG#11555 fix
|
||||
CHECK TABLE v1, v2, v3, v4, v5, v6;
|
||||
drop function f1;
|
||||
drop function f2;
|
||||
|
Reference in New Issue
Block a user