2006-11-13 20:06:45 +04:00
|
|
|
# this test mostly test privilege control (what doesn't work
|
|
|
|
# in the embedded server by default). So disabled in embedded-server mode
|
|
|
|
-- source include/not_embedded.inc
|
|
|
|
|
2005-05-06 19:06:10 +00:00
|
|
|
-- source include/testdb_only.inc
|
|
|
|
|
2006-05-30 10:45:23 +05:00
|
|
|
--disable_warnings
|
|
|
|
drop table if exists t1,t2;
|
|
|
|
drop view if exists v1,v2;
|
|
|
|
drop function if exists f1;
|
|
|
|
drop function if exists f2;
|
|
|
|
--enable_warnings
|
|
|
|
|
2005-05-06 19:06:10 +00:00
|
|
|
use INFORMATION_SCHEMA;
|
2005-05-24 14:35:23 +04:00
|
|
|
--replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema
|
Fixes to tests and their results, to account for differences between InnoDB 1.0.4 and the old builtin.
All committed result differences have either been verified by me or copied from Oracle's provided
results (storage/innodb_plugin/mysql-test/*.result, storage/innodb_plugin/mysql-test/patches).
mysql-test/r/information_schema.result:
queries changed a bit
mysql-test/r/information_schema_db.result:
queries changed a bit
mysql-test/r/innodb-autoinc.result:
importing piece from storage/innodb_plugin/mysql-test/innodb-autoinc.result
mysql-test/r/innodb.result:
result close to storage/innodb_plugin/innodb.result, except 4095 pages instead of 8191, which makes
sense as Summit runs with a buffer pool of 64M, whereas the mentioned result file was made with
a buffer pool of 128M.
mysql-test/r/mysqlshow.result:
InnoDB I_S tables have arrived
mysql-test/suite/funcs_1/r/is_columns_is.result:
queries changed a bit
mysql-test/suite/funcs_1/r/is_columns_is_embedded.result:
queries changed a bit
mysql-test/suite/funcs_1/r/is_tables_is.result:
queries changed a bit
mysql-test/suite/funcs_1/t/is_columns_is.test:
making I_S queries ignore InnoDB I_S tables
mysql-test/suite/funcs_1/t/is_columns_is_embedded.test:
making I_S queries ignore InnoDB I_S tables
mysql-test/suite/funcs_1/t/is_tables_is.test:
making I_S queries ignore InnoDB I_S tables
mysql-test/suite/innodb/r/innodb-zip.result:
result update
mysql-test/suite/innodb/t/innodb-zip.test:
439, as size of prefix key, throws error with certain system zlib (ubuntu
"intrepid") but not with zlib bundled with MySQL, because zlib's
compressBound() are different (and used by InnoDB's page_zip_empty_size()).
mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result:
result update
mysql-test/suite/sys_vars/r/innodb_lock_wait_timeout_basic.result:
result update
mysql-test/suite/sys_vars/r/innodb_sync_spin_loops_basic_32.result:
result update (default value is 30 in the plugin, 20 in the builtin)
mysql-test/suite/sys_vars/r/innodb_sync_spin_loops_basic_64.result:
result update (default value is 30 in the plugin, 20 in the builtin)
mysql-test/suite/sys_vars/r/table_definition_cache_basic.result:
result update (default value is 400 in Summit)
mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test:
variable is writable in the plugin (patch from Oracle)
mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test:
variable is per-session in the plugin (patch from Oracle)
mysql-test/t/information_schema.test:
making I_S queries ignore InnoDB I_S tables
mysql-test/t/information_schema_db.test:
making I_S queries ignore InnoDB I_S tables
mysql-test/t/innodb-autoinc.test:
importing piece from storage/innodb_plugin/mysql-test/innodb-autoinc.test
mysql-test/t/innodb.test:
importing most of storage/innodb_plugin/t/innodb.test. Most replace_result were not needed (no path printed), some where (for --embedded).
mysql-test/t/mysqlshow.test:
output of test now depends on InnoDB or not InnoDB. As there is no way to make mysqlshow
produce a single output in those two cases (no way to make it exclude InnoDB I_S
tables), let the test depend on InnoDB, it isn't a very selective condition, and the
test is simple enough.
storage/innobase/CMakeLists.txt:
thanks Vlad for the noticing () vs {}
2009-08-07 22:04:53 +02:00
|
|
|
show tables where Tables_in_information_schema not like "Innodb%";
|
2005-05-24 14:35:23 +04:00
|
|
|
--replace_result 'Tables_in_INFORMATION_SCHEMA (T%)' 'Tables_in_information_schema (T%)'
|
2005-05-06 19:06:10 +00:00
|
|
|
show tables from INFORMATION_SCHEMA like 'T%';
|
|
|
|
create database `inf%`;
|
2006-05-30 10:45:23 +05:00
|
|
|
create database mbase;
|
2005-05-06 19:06:10 +00:00
|
|
|
use `inf%`;
|
|
|
|
show tables;
|
2006-03-20 13:42:02 +04:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bug#18113 SELECT * FROM information_schema.xxx crashes server
|
2006-05-30 10:45:23 +05:00
|
|
|
# Bug#17204 second CALL to procedure crashes Server
|
2006-03-20 13:42:02 +04:00
|
|
|
# Crash happened when one selected data from one of INFORMATION_SCHEMA
|
|
|
|
# tables and in order to build its contents server had to open view which
|
|
|
|
# used stored function and table or view on which one had not global or
|
|
|
|
# database-level privileges (e.g. had only table-level or had no
|
|
|
|
# privileges at all).
|
|
|
|
#
|
|
|
|
grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
|
2006-05-30 10:45:23 +05:00
|
|
|
grant all privileges on `mbase`.* to 'mysqltest_1'@'localhost';
|
2006-03-20 13:42:02 +04:00
|
|
|
create table t1 (f1 int);
|
|
|
|
delimiter |;
|
|
|
|
create function func1(curr_int int) returns int
|
|
|
|
begin
|
|
|
|
declare ret_val int;
|
|
|
|
select max(f1) from t1 into ret_val;
|
|
|
|
return ret_val;
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
create view v1 as select f1 from t1 where f1 = func1(f1);
|
2006-05-30 10:45:23 +05:00
|
|
|
create function func2() returns int return 1;
|
|
|
|
|
|
|
|
use mbase;
|
|
|
|
delimiter |;
|
|
|
|
create procedure p1 ()
|
|
|
|
begin
|
|
|
|
select table_name from information_schema.key_column_usage
|
|
|
|
order by table_name;
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
|
2009-05-15 11:59:31 +02:00
|
|
|
create table t1
|
2006-05-30 10:45:23 +05:00
|
|
|
(f1 int(10) unsigned not null,
|
|
|
|
f2 varchar(100) not null,
|
|
|
|
primary key (f1), unique key (f2));
|
|
|
|
|
2006-03-20 13:42:02 +04:00
|
|
|
connect (user1,localhost,mysqltest_1,,);
|
|
|
|
connection user1;
|
|
|
|
--disable_result_log
|
|
|
|
select * from information_schema.tables;
|
2006-05-30 10:45:23 +05:00
|
|
|
call mbase.p1();
|
|
|
|
call mbase.p1();
|
|
|
|
call mbase.p1();
|
2006-03-20 13:42:02 +04:00
|
|
|
--enable_result_log
|
2006-05-30 10:45:23 +05:00
|
|
|
|
2006-03-20 13:42:02 +04:00
|
|
|
connection default;
|
2006-05-30 10:45:23 +05:00
|
|
|
use `inf%`;
|
2006-03-20 13:42:02 +04:00
|
|
|
drop user mysqltest_1@localhost;
|
2006-05-30 10:45:23 +05:00
|
|
|
drop table t1;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='inf%' and func2();
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='inf%' and func2();
|
2006-03-20 13:42:02 +04:00
|
|
|
drop view v1;
|
|
|
|
drop function func1;
|
2006-05-30 10:45:23 +05:00
|
|
|
drop function func2;
|
2006-03-20 13:42:02 +04:00
|
|
|
|
2005-05-06 19:06:10 +00:00
|
|
|
drop database `inf%`;
|
2006-05-30 10:45:23 +05:00
|
|
|
drop procedure mbase.p1;
|
|
|
|
drop database mbase;
|
2008-10-02 14:37:07 +05:00
|
|
|
disconnect user1;
|
2006-05-30 10:45:23 +05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
|
|
|
|
#
|
|
|
|
use test;
|
|
|
|
create table t1 (i int);
|
|
|
|
create function f1 () returns int return (select max(i) from t1);
|
|
|
|
create view v1 as select f1();
|
|
|
|
create table t2 (id int);
|
|
|
|
create function f2 () returns int return (select max(i) from t2);
|
|
|
|
create view v2 as select f2();
|
|
|
|
drop table t2;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='test';
|
|
|
|
drop table t1;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='test';
|
|
|
|
drop function f1;
|
|
|
|
drop function f2;
|
|
|
|
drop view v1, v2;
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
|
|
|
|
#
|
2009-05-15 11:59:31 +02:00
|
|
|
# Bug#20543 select on information_schema strange warnings, view, different
|
|
|
|
# schemas/users
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
#
|
|
|
|
#
|
|
|
|
create database testdb_1;
|
|
|
|
create user testdb_1@localhost;
|
|
|
|
grant all on testdb_1.* to testdb_1@localhost with grant option;
|
|
|
|
|
|
|
|
create user testdb_2@localhost;
|
|
|
|
grant all on test.* to testdb_2@localhost with grant option;
|
|
|
|
|
|
|
|
connect (testdb_1,localhost,testdb_1,,test);
|
|
|
|
use testdb_1;
|
|
|
|
create table t1 (f1 char(4));
|
|
|
|
create view v1 as select f1 from t1;
|
|
|
|
grant insert on v1 to testdb_2@localhost;
|
|
|
|
|
2007-03-23 19:24:03 +01:00
|
|
|
create view v5 as select f1 from t1;
|
|
|
|
grant show view on v5 to testdb_2@localhost;
|
|
|
|
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
2007-03-23 19:24:03 +01:00
|
|
|
create definer=`no_such_user`@`no_such_host` view v6 as select f1 from t1;
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
use testdb_1;
|
|
|
|
create view v6 as select f1 from t1;
|
|
|
|
grant show view on v6 to testdb_2@localhost;
|
|
|
|
|
|
|
|
create table t2 (f1 char(4));
|
|
|
|
create definer=`no_such_user`@`no_such_host` view v7 as select * from t2;
|
|
|
|
|
|
|
|
show fields from testdb_1.v6;
|
|
|
|
show create view testdb_1.v6;
|
|
|
|
|
|
|
|
show create view testdb_1.v7;
|
|
|
|
show fields from testdb_1.v7;
|
|
|
|
|
|
|
|
connection testdb_1;
|
|
|
|
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
create table t3 (f1 char(4), f2 char(4));
|
|
|
|
create view v3 as select f1,f2 from t3;
|
|
|
|
grant insert(f1), insert(f2) on v3 to testdb_2@localhost;
|
|
|
|
|
|
|
|
connect (testdb_2,localhost,testdb_2,,test);
|
|
|
|
create view v2 as select f1 from testdb_1.v1;
|
|
|
|
create view v4 as select f1,f2 from testdb_1.v3;
|
|
|
|
|
2007-03-23 19:24:03 +01:00
|
|
|
show fields from testdb_1.v5;
|
|
|
|
show create view testdb_1.v5;
|
|
|
|
|
|
|
|
show fields from testdb_1.v6;
|
|
|
|
show create view testdb_1.v6;
|
|
|
|
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
connection testdb_1;
|
2007-03-23 19:24:03 +01:00
|
|
|
show fields from testdb_1.v7;
|
|
|
|
show create view testdb_1.v7;
|
|
|
|
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
revoke insert(f1) on v3 from testdb_2@localhost;
|
2007-03-23 19:24:03 +01:00
|
|
|
revoke show view on v5 from testdb_2@localhost;
|
|
|
|
connection default;
|
|
|
|
use testdb_1;
|
|
|
|
revoke show view on v6 from testdb_2@localhost;
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
connection testdb_2;
|
|
|
|
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
2007-03-23 19:24:03 +01:00
|
|
|
show fields from testdb_1.v5;
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
2007-03-23 19:24:03 +01:00
|
|
|
show create view testdb_1.v5;
|
|
|
|
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
2007-03-23 19:24:03 +01:00
|
|
|
show fields from testdb_1.v6;
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
2007-03-23 19:24:03 +01:00
|
|
|
show create view testdb_1.v6;
|
|
|
|
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
2007-03-23 19:24:03 +01:00
|
|
|
show fields from testdb_1.v7;
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
2007-03-23 19:24:03 +01:00
|
|
|
show create view testdb_1.v7;
|
|
|
|
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_VIEW_NO_EXPLAIN
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
show create view v4;
|
2009-05-15 11:59:31 +02:00
|
|
|
#--error ER_VIEW_NO_EXPLAIN
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
show fields from v4;
|
|
|
|
|
|
|
|
show fields from v2;
|
|
|
|
show fields from testdb_1.v1;
|
|
|
|
show create view v2;
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
show create view testdb_1.v1;
|
|
|
|
|
2009-05-15 11:59:31 +02:00
|
|
|
select table_name from information_schema.columns a
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
where a.table_name = 'v2';
|
2009-05-15 11:59:31 +02:00
|
|
|
select view_definition from information_schema.views a
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
where a.table_name = 'v2';
|
2009-05-15 11:59:31 +02:00
|
|
|
select view_definition from information_schema.views a
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
where a.table_name = 'testdb_1.v1';
|
|
|
|
|
2009-05-15 11:59:31 +02:00
|
|
|
--error ER_VIEW_INVALID
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
select * from v2;
|
|
|
|
|
|
|
|
connection default;
|
2007-03-23 19:24:03 +01:00
|
|
|
use test;
|
|
|
|
drop view testdb_1.v1, v2, testdb_1.v3, v4;
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
drop database testdb_1;
|
2009-05-15 11:59:31 +02:00
|
|
|
connection testdb_1;
|
|
|
|
disconnect testdb_1;
|
|
|
|
--source include/wait_until_disconnected.inc
|
|
|
|
connection testdb_2;
|
|
|
|
disconnect testdb_2;
|
|
|
|
--source include/wait_until_disconnected.inc
|
|
|
|
connection default;
|
Bug#20543 select on information_schema strange warnings, view, different schemas/users
The fix is: if user has privileges to view fields and user has any
(insert,select,delete,update) privileges on underlying view
then 'show fields' and select from I_S.COLUMNS table are sucsessful.
mysql-test/r/information_schema_db.result:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test result
mysql-test/t/information_schema_db.test:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
test case
sql/sql_acl.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
checked that user has privileges on underlying view and if it's true
set allowed_show to true for top view.
sql/sql_show.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
removed unnecessary rights check.'tables->allowed_show' check is used instead
sql/sql_view.cc:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
skip the check of SHOW_VIEW_ACL privilege on underlying view. It is done later during
execution of find_field_in_table_ref function.
sql/table.h:
Bug#20543 select on information_schema strange warnings, view, different schemas/users
'allowed_show' is set during rights check for view. If true then user has privileges
for 'show create view', etc
2006-07-25 17:23:25 +05:00
|
|
|
drop user testdb_1@localhost;
|
2006-08-07 11:56:22 +05:00
|
|
|
drop user testdb_2@localhost;
|
2008-10-02 14:37:07 +05:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS
|
|
|
|
#
|
|
|
|
create database testdb_1;
|
|
|
|
create table testdb_1.t1 (a int);
|
|
|
|
create view testdb_1.v1 as select * from testdb_1.t1;
|
|
|
|
|
|
|
|
grant show view on testdb_1.* to mysqltest_1@localhost;
|
|
|
|
grant select on testdb_1.v1 to mysqltest_1@localhost;
|
|
|
|
|
|
|
|
connect (user1,localhost,mysqltest_1,,test);
|
|
|
|
connection user1;
|
|
|
|
select table_schema, table_name, view_definition from information_schema.views
|
|
|
|
where table_name='v1';
|
|
|
|
show create view testdb_1.v1;
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
revoke select on testdb_1.v1 from mysqltest_1@localhost;
|
|
|
|
connection user1;
|
|
|
|
select table_schema, table_name, view_definition from information_schema.views
|
|
|
|
where table_name='v1';
|
|
|
|
--error ER_TABLEACCESS_DENIED_ERROR
|
|
|
|
show create view testdb_1.v1;
|
|
|
|
|
|
|
|
connection default;
|
|
|
|
drop user mysqltest_1@localhost;
|
|
|
|
drop database testdb_1;
|
2009-05-15 11:59:31 +02:00
|
|
|
connection user1;
|
2008-10-02 14:37:07 +05:00
|
|
|
disconnect user1;
|
2009-05-15 11:59:31 +02:00
|
|
|
--source include/wait_until_disconnected.inc
|
|
|
|
connection default;
|