mariadb/mysql-test/main/information_schema_db.test

334 lines
10 KiB
Text
Raw Normal View History

several fixes to make tests pass in embedded-server mode libmysqld/lib_sql.cc: check for bootstrap added mysql-test/include/federated.inc: disabled in embedded mysql-test/mysql-test-run.pl: we disable ssh in embedded server mysql-test/r/bdb.result: part moved to bdb_notembedded as it uses binlog mysql-test/r/flush_block_commit.result: part moved to flush_block_commit_notembedded mysql-test/r/insert.result: part moved to insert_notembedded as delayed works differently in embedded server mysql-test/r/insert_select.result: part moved to insert_notembedded as GRANTS usually disabled in embedded server mysql-test/r/join.result: access rights hidden in result mysql-test/t/backup.test: now available in embedded server mysql-test/t/bdb.test: part moved to bdb_notembedded as it uses binlog mysql-test/t/delayed.test: code trimmed mysql-test/t/execution_constants.test: skipped in embedded-server mode mysql-test/t/flush_block_commit.test: moved to flush_block_commit_notembedded mysql-test/t/information_schema_db.test: skipped in embedded-server mysql-test/t/innodb.test: directories replaced to be embedded-server compliant mysql-test/t/insert.test: part moved to insert_notembedded mysql-test/t/insert_select.test: part moved to insert_notembedded mysql-test/t/join.test: access rights hidden mysql-test/t/status.test: skipped in embedded server mysql-test/t/trigger.test: directories replaced to be embedded-server compliant sql/item_strfunc.cc: extra contexts not needed whan access checks disabled sql/share/errmsg.txt: bigger paths reserved to prevent test's fails mysql-test/r/bdb_notembedded.result: ***MISSING WEAVE*** mysql-test/r/flush_block_commit_notembedded.result: added mysql-test/r/insert_notembedded.result: added mysql-test/t/bdb_notembedded.test: ***MISSING WEAVE*** mysql-test/t/flush_block_commit_notembedded.test: added mysql-test/t/insert_notembedded.test: added
2006-11-13 17:06:45 +01:00
# this test mostly test privilege control (what doesn't work
Bug#27145 EXTRA_ACL troubles The flag EXTRA_ACL is used in conjugation with our access checks, yet it is not clear what impact this flag has. This is a code clean up which replaces use of EXTRA_ACL with an explicit function parameter. The patch also fixes privilege checks for: - SHOW CREATE TABLE: The new privilege requirement is any privilege on the table-level. - CHECKSUM TABLE: Requires SELECT on the table level. - SHOW CREATE VIEW: Requires SHOW_VIEW and SELECT on the table level (just as the manual claims) - SHOW INDEX: Requires any privilege on any column combination. mysql-test/r/grant.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant2.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant4.result: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/r/information_schema_db.result: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/r/outfile.result: * Changed error code mysql-test/r/view_grant.result: * Additional SELECT privilege is now needed for SHOW CREATE VIEW mysql-test/t/grant4.test: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/t/information_schema_db.test: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/t/outfile.test: * Changed error code mysql-test/t/view_grant.test: * Additional SELECT privilege is now needed for SHOW CREATE VIEW sql/mysql_priv.h: * Replaced EXTRA_ACL with a parameter sql/sp_head.cc: * Replaced EXTRA_ACL with a parameter sql/sql_acl.cc: * Converted function documentation to doxygen and clarified some behaviors. * Changed value from uint to bool to better reflect its meaning. * Removed pointless variable orig_want_access * Added function has_any_table_level_privileges to help with requirements checks during SHOW CREATE TABLE. sql/sql_acl.h: * changed signature of check_grant() * introduced access control function has_any_table_leevl_privileges() sql/sql_base.cc: * Check_table_access has new signature sql/sql_cache.cc: * Check_table_access has new signature sql/sql_parse.cc: * Rewrote function documentation in doxygen comments for: check_access, check_table_acces, check_grant. * Removed EXTRA_ACL flag where it doesn't hold any meaningful purpose anymore and replaced it with a function parameter where any privileges on any column combination would satisfy the requirement. * Fixed privilege check for SHOW COLUMNS and SHOW INDEX * Modified check_table_access to gain clarity in what EXTRA_ACL actually does. * Modified check_access to gain clarity in what EXTRA_ACL actually does. * Fixed privilege check for CREATE TABLE .. LIKE .. ; It now requires SELECT privileges on the table. * Fixed privilege check for SHOW CREATE TABLE ..; It now requires any privilege on the table level. sql/sql_plugin.cc: * check_table_access has new signature sql/sql_prepare.cc: * check_table_access has new signature sql/sql_show.cc: * check_table_access has new signature sql/sql_trigger.cc: * check_table_access has new signature sql/sql_update.cc: * check grant has new signature sql/sql_view.cc: * check_table_access has new signature
2009-10-19 14:58:13 +02:00
# in the embedded server by default). So skip the test in embedded-server mode.
several fixes to make tests pass in embedded-server mode libmysqld/lib_sql.cc: check for bootstrap added mysql-test/include/federated.inc: disabled in embedded mysql-test/mysql-test-run.pl: we disable ssh in embedded server mysql-test/r/bdb.result: part moved to bdb_notembedded as it uses binlog mysql-test/r/flush_block_commit.result: part moved to flush_block_commit_notembedded mysql-test/r/insert.result: part moved to insert_notembedded as delayed works differently in embedded server mysql-test/r/insert_select.result: part moved to insert_notembedded as GRANTS usually disabled in embedded server mysql-test/r/join.result: access rights hidden in result mysql-test/t/backup.test: now available in embedded server mysql-test/t/bdb.test: part moved to bdb_notembedded as it uses binlog mysql-test/t/delayed.test: code trimmed mysql-test/t/execution_constants.test: skipped in embedded-server mode mysql-test/t/flush_block_commit.test: moved to flush_block_commit_notembedded mysql-test/t/information_schema_db.test: skipped in embedded-server mysql-test/t/innodb.test: directories replaced to be embedded-server compliant mysql-test/t/insert.test: part moved to insert_notembedded mysql-test/t/insert_select.test: part moved to insert_notembedded mysql-test/t/join.test: access rights hidden mysql-test/t/status.test: skipped in embedded server mysql-test/t/trigger.test: directories replaced to be embedded-server compliant sql/item_strfunc.cc: extra contexts not needed whan access checks disabled sql/share/errmsg.txt: bigger paths reserved to prevent test's fails mysql-test/r/bdb_notembedded.result: ***MISSING WEAVE*** mysql-test/r/flush_block_commit_notembedded.result: added mysql-test/r/insert_notembedded.result: added mysql-test/t/bdb_notembedded.test: ***MISSING WEAVE*** mysql-test/t/flush_block_commit_notembedded.test: added mysql-test/t/insert_notembedded.test: added
2006-11-13 17:06:45 +01:00
-- source include/not_embedded.inc
-- source include/have_innodb.inc
-- source include/testdb_only.inc
set local sql_mode="";
set global sql_mode="";
--replace_result 'Tables_in_INFORMATION_SCHEMA (T%)' 'Tables_in_information_schema (T%)'
2014-08-25 19:08:55 +02:00
--sorted_result
show tables from INFORMATION_SCHEMA like 'T%';
create database `inf%`;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
create database mbase;
use `inf%`;
show tables;
--echo #
--echo # Bug#18113 SELECT * FROM information_schema.xxx crashes server
--echo # Bug#17204 second CALL to procedure crashes Server
--echo #
# 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).
#
--disable_view_protocol
grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
grant all privileges on `mbase`.* to 'mysqltest_1'@'localhost';
create table t1 (f1 int);
delimiter |;
--enable_prepare_warnings
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|
--disable_prepare_warnings
delimiter ;|
create view v1 as select f1 from t1 where f1 = func1(f1);
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02: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 ;|
create table t1
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
(f1 int(10) unsigned not null,
f2 varchar(100) not null,
primary key (f1), unique key (f2));
connect (user1,localhost,mysqltest_1,,"*NO-ONE*");
connection user1;
--disable_result_log
select * from information_schema.tables;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
call mbase.p1();
call mbase.p1();
call mbase.p1();
--enable_result_log
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
connection default;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
use `inf%`;
drop user mysqltest_1@localhost;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02: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();
drop view v1;
drop function func1;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
drop function func2;
drop database `inf%`;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
drop procedure mbase.p1;
drop database mbase;
disconnect user1;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
--echo #
--echo # Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
--echo #
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
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' order by table_name;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
drop table t1;
select table_name, table_type, table_comment from information_schema.tables
where table_schema='test' order by table_name;
Bug#17204 "second CALL to procedure crashes Server" Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
2006-05-30 07:45:23 +02:00
drop function f1;
drop function f2;
drop view v1, v2;
--enable_view_protocol
--echo #
--echo # Bug#20543 select on information_schema strange warnings, view, different
--echo # schemas/users
--echo #
--disable_service_connection
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,,testdb_1);
create table t1 (f1 char(4));
create view v1 as select f1 from t1;
grant insert on v1 to testdb_2@localhost;
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
create view v5 as select f1 from t1;
Bug#27145 EXTRA_ACL troubles The flag EXTRA_ACL is used in conjugation with our access checks, yet it is not clear what impact this flag has. This is a code clean up which replaces use of EXTRA_ACL with an explicit function parameter. The patch also fixes privilege checks for: - SHOW CREATE TABLE: The new privilege requirement is any privilege on the table-level. - CHECKSUM TABLE: Requires SELECT on the table level. - SHOW CREATE VIEW: Requires SHOW_VIEW and SELECT on the table level (just as the manual claims) - SHOW INDEX: Requires any privilege on any column combination. mysql-test/r/grant.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant2.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant4.result: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/r/information_schema_db.result: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/r/outfile.result: * Changed error code mysql-test/r/view_grant.result: * Additional SELECT privilege is now needed for SHOW CREATE VIEW mysql-test/t/grant4.test: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/t/information_schema_db.test: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/t/outfile.test: * Changed error code mysql-test/t/view_grant.test: * Additional SELECT privilege is now needed for SHOW CREATE VIEW sql/mysql_priv.h: * Replaced EXTRA_ACL with a parameter sql/sp_head.cc: * Replaced EXTRA_ACL with a parameter sql/sql_acl.cc: * Converted function documentation to doxygen and clarified some behaviors. * Changed value from uint to bool to better reflect its meaning. * Removed pointless variable orig_want_access * Added function has_any_table_level_privileges to help with requirements checks during SHOW CREATE TABLE. sql/sql_acl.h: * changed signature of check_grant() * introduced access control function has_any_table_leevl_privileges() sql/sql_base.cc: * Check_table_access has new signature sql/sql_cache.cc: * Check_table_access has new signature sql/sql_parse.cc: * Rewrote function documentation in doxygen comments for: check_access, check_table_acces, check_grant. * Removed EXTRA_ACL flag where it doesn't hold any meaningful purpose anymore and replaced it with a function parameter where any privileges on any column combination would satisfy the requirement. * Fixed privilege check for SHOW COLUMNS and SHOW INDEX * Modified check_table_access to gain clarity in what EXTRA_ACL actually does. * Modified check_access to gain clarity in what EXTRA_ACL actually does. * Fixed privilege check for CREATE TABLE .. LIKE .. ; It now requires SELECT privileges on the table. * Fixed privilege check for SHOW CREATE TABLE ..; It now requires any privilege on the table level. sql/sql_plugin.cc: * check_table_access has new signature sql/sql_prepare.cc: * check_table_access has new signature sql/sql_show.cc: * check_table_access has new signature sql/sql_trigger.cc: * check_table_access has new signature sql/sql_update.cc: * check grant has new signature sql/sql_view.cc: * check_table_access has new signature
2009-10-19 14:58:13 +02:00
grant select, show view on v5 to testdb_2@localhost;
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
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;
Bug#27145 EXTRA_ACL troubles The flag EXTRA_ACL is used in conjugation with our access checks, yet it is not clear what impact this flag has. This is a code clean up which replaces use of EXTRA_ACL with an explicit function parameter. The patch also fixes privilege checks for: - SHOW CREATE TABLE: The new privilege requirement is any privilege on the table-level. - CHECKSUM TABLE: Requires SELECT on the table level. - SHOW CREATE VIEW: Requires SHOW_VIEW and SELECT on the table level (just as the manual claims) - SHOW INDEX: Requires any privilege on any column combination. mysql-test/r/grant.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant2.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant4.result: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/r/information_schema_db.result: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/r/outfile.result: * Changed error code mysql-test/r/view_grant.result: * Additional SELECT privilege is now needed for SHOW CREATE VIEW mysql-test/t/grant4.test: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/t/information_schema_db.test: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/t/outfile.test: * Changed error code mysql-test/t/view_grant.test: * Additional SELECT privilege is now needed for SHOW CREATE VIEW sql/mysql_priv.h: * Replaced EXTRA_ACL with a parameter sql/sp_head.cc: * Replaced EXTRA_ACL with a parameter sql/sql_acl.cc: * Converted function documentation to doxygen and clarified some behaviors. * Changed value from uint to bool to better reflect its meaning. * Removed pointless variable orig_want_access * Added function has_any_table_level_privileges to help with requirements checks during SHOW CREATE TABLE. sql/sql_acl.h: * changed signature of check_grant() * introduced access control function has_any_table_leevl_privileges() sql/sql_base.cc: * Check_table_access has new signature sql/sql_cache.cc: * Check_table_access has new signature sql/sql_parse.cc: * Rewrote function documentation in doxygen comments for: check_access, check_table_acces, check_grant. * Removed EXTRA_ACL flag where it doesn't hold any meaningful purpose anymore and replaced it with a function parameter where any privileges on any column combination would satisfy the requirement. * Fixed privilege check for SHOW COLUMNS and SHOW INDEX * Modified check_table_access to gain clarity in what EXTRA_ACL actually does. * Modified check_access to gain clarity in what EXTRA_ACL actually does. * Fixed privilege check for CREATE TABLE .. LIKE .. ; It now requires SELECT privileges on the table. * Fixed privilege check for SHOW CREATE TABLE ..; It now requires any privilege on the table level. sql/sql_plugin.cc: * check_table_access has new signature sql/sql_prepare.cc: * check_table_access has new signature sql/sql_show.cc: * check_table_access has new signature sql/sql_trigger.cc: * check_table_access has new signature sql/sql_update.cc: * check grant has new signature sql/sql_view.cc: * check_table_access has new signature
2009-10-19 14:58:13 +02:00
grant select, show view on v6 to testdb_2@localhost;
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
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;
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;
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
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;
connection testdb_1;
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
show fields from testdb_1.v7;
show create view testdb_1.v7;
revoke insert(f1) on v3 from testdb_2@localhost;
Bug#27145 EXTRA_ACL troubles The flag EXTRA_ACL is used in conjugation with our access checks, yet it is not clear what impact this flag has. This is a code clean up which replaces use of EXTRA_ACL with an explicit function parameter. The patch also fixes privilege checks for: - SHOW CREATE TABLE: The new privilege requirement is any privilege on the table-level. - CHECKSUM TABLE: Requires SELECT on the table level. - SHOW CREATE VIEW: Requires SHOW_VIEW and SELECT on the table level (just as the manual claims) - SHOW INDEX: Requires any privilege on any column combination. mysql-test/r/grant.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant2.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant4.result: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/r/information_schema_db.result: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/r/outfile.result: * Changed error code mysql-test/r/view_grant.result: * Additional SELECT privilege is now needed for SHOW CREATE VIEW mysql-test/t/grant4.test: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/t/information_schema_db.test: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/t/outfile.test: * Changed error code mysql-test/t/view_grant.test: * Additional SELECT privilege is now needed for SHOW CREATE VIEW sql/mysql_priv.h: * Replaced EXTRA_ACL with a parameter sql/sp_head.cc: * Replaced EXTRA_ACL with a parameter sql/sql_acl.cc: * Converted function documentation to doxygen and clarified some behaviors. * Changed value from uint to bool to better reflect its meaning. * Removed pointless variable orig_want_access * Added function has_any_table_level_privileges to help with requirements checks during SHOW CREATE TABLE. sql/sql_acl.h: * changed signature of check_grant() * introduced access control function has_any_table_leevl_privileges() sql/sql_base.cc: * Check_table_access has new signature sql/sql_cache.cc: * Check_table_access has new signature sql/sql_parse.cc: * Rewrote function documentation in doxygen comments for: check_access, check_table_acces, check_grant. * Removed EXTRA_ACL flag where it doesn't hold any meaningful purpose anymore and replaced it with a function parameter where any privileges on any column combination would satisfy the requirement. * Fixed privilege check for SHOW COLUMNS and SHOW INDEX * Modified check_table_access to gain clarity in what EXTRA_ACL actually does. * Modified check_access to gain clarity in what EXTRA_ACL actually does. * Fixed privilege check for CREATE TABLE .. LIKE .. ; It now requires SELECT privileges on the table. * Fixed privilege check for SHOW CREATE TABLE ..; It now requires any privilege on the table level. sql/sql_plugin.cc: * check_table_access has new signature sql/sql_prepare.cc: * check_table_access has new signature sql/sql_show.cc: * check_table_access has new signature sql/sql_trigger.cc: * check_table_access has new signature sql/sql_update.cc: * check grant has new signature sql/sql_view.cc: * check_table_access has new signature
2009-10-19 14:58:13 +02:00
revoke select,show view on v5 from testdb_2@localhost;
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
connection default;
use testdb_1;
Bug#27145 EXTRA_ACL troubles The flag EXTRA_ACL is used in conjugation with our access checks, yet it is not clear what impact this flag has. This is a code clean up which replaces use of EXTRA_ACL with an explicit function parameter. The patch also fixes privilege checks for: - SHOW CREATE TABLE: The new privilege requirement is any privilege on the table-level. - CHECKSUM TABLE: Requires SELECT on the table level. - SHOW CREATE VIEW: Requires SHOW_VIEW and SELECT on the table level (just as the manual claims) - SHOW INDEX: Requires any privilege on any column combination. mysql-test/r/grant.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant2.result: * Error message now shows correct command (SHOW instead of SELECT) mysql-test/r/grant4.result: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/r/information_schema_db.result: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/r/outfile.result: * Changed error code mysql-test/r/view_grant.result: * Additional SELECT privilege is now needed for SHOW CREATE VIEW mysql-test/t/grant4.test: * This test file tests privilege requirements for SHOW COLUMNS CREATE TABLE .. LIKE SHOW CREATE TABLE SHOW INDEX CHECKSUM TABLE SHOW CREATE VIEW mysql-test/t/information_schema_db.test: * Added SELECT privilege to testdb_2 as SHOW CREATE VIEW now demands this privilege as well as SHOW VIEW. mysql-test/t/outfile.test: * Changed error code mysql-test/t/view_grant.test: * Additional SELECT privilege is now needed for SHOW CREATE VIEW sql/mysql_priv.h: * Replaced EXTRA_ACL with a parameter sql/sp_head.cc: * Replaced EXTRA_ACL with a parameter sql/sql_acl.cc: * Converted function documentation to doxygen and clarified some behaviors. * Changed value from uint to bool to better reflect its meaning. * Removed pointless variable orig_want_access * Added function has_any_table_level_privileges to help with requirements checks during SHOW CREATE TABLE. sql/sql_acl.h: * changed signature of check_grant() * introduced access control function has_any_table_leevl_privileges() sql/sql_base.cc: * Check_table_access has new signature sql/sql_cache.cc: * Check_table_access has new signature sql/sql_parse.cc: * Rewrote function documentation in doxygen comments for: check_access, check_table_acces, check_grant. * Removed EXTRA_ACL flag where it doesn't hold any meaningful purpose anymore and replaced it with a function parameter where any privileges on any column combination would satisfy the requirement. * Fixed privilege check for SHOW COLUMNS and SHOW INDEX * Modified check_table_access to gain clarity in what EXTRA_ACL actually does. * Modified check_access to gain clarity in what EXTRA_ACL actually does. * Fixed privilege check for CREATE TABLE .. LIKE .. ; It now requires SELECT privileges on the table. * Fixed privilege check for SHOW CREATE TABLE ..; It now requires any privilege on the table level. sql/sql_plugin.cc: * check_table_access has new signature sql/sql_prepare.cc: * check_table_access has new signature sql/sql_show.cc: * check_table_access has new signature sql/sql_trigger.cc: * check_table_access has new signature sql/sql_update.cc: * check grant has new signature sql/sql_view.cc: * check_table_access has new signature
2009-10-19 14:58:13 +02:00
revoke select,show view on v6 from testdb_2@localhost;
connection testdb_2;
--error ER_TABLEACCESS_DENIED_ERROR
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
show fields from testdb_1.v5;
--error ER_TABLEACCESS_DENIED_ERROR
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
show create view testdb_1.v5;
--error ER_TABLEACCESS_DENIED_ERROR
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
show fields from testdb_1.v6;
--error ER_TABLEACCESS_DENIED_ERROR
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
show create view testdb_1.v6;
--error ER_TABLEACCESS_DENIED_ERROR
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
show fields from testdb_1.v7;
--error ER_TABLEACCESS_DENIED_ERROR
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
show create view testdb_1.v7;
show create view v4;
#--error ER_VIEW_NO_EXPLAIN
show fields from v4;
show fields from v2;
show fields from testdb_1.v1;
show create view v2;
--error ER_TABLEACCESS_DENIED_ERROR
show create view testdb_1.v1;
select table_name from information_schema.columns a
where a.table_name = 'v2';
select view_definition from information_schema.views a
where a.table_name = 'v2';
select view_definition from information_schema.views a
where a.table_name = 'testdb_1.v1';
--error ER_VIEW_INVALID
select * from v2;
connection default;
Bug #26817: mysqldump fails to backup database containing view with invalid definer give some leeway on required permissions for SHOW FIELDS on views so an unknonwn DEFINER will no longer break mysqldump client/client_priv.h: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") client/mysqldump.c: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/r/information_schema_db.result: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") mysql-test/t/information_schema_db.test: Bug #26817: mysqldump fails to backup database containing view with invalid definer New option for mysqldump: redirect stderr to file ("2> for Windows") sql/sql_base.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM sql/sql_parse.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer be a little more lenient for SHOW FIELDS FROM on views on views sql/sql_view.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE sql/table.cc: Bug #26817: mysqldump fails to backup database containing view with invalid definer give SHOW FIELDS the same perks as SHOW CREATE
2007-03-23 19:24:03 +01:00
use test;
drop view testdb_1.v1, v2, testdb_1.v3, v4;
drop database testdb_1;
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;
drop user testdb_1@localhost;
drop user testdb_2@localhost;
--echo #
--echo # Bug#22763 Disrepancy between SHOW CREATE VIEW and I_S.VIEWS
--echo #
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,,"*NO-ONE*");
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;
connection user1;
disconnect user1;
--source include/wait_until_disconnected.inc
connection default;
set global sql_mode=default;
--echo #
--echo # MDEV-20549 SQL SECURITY DEFINER does not work for INFORMATION_SCHEMA tables
--echo #
create user foo@localhost;
grant select on test.* to foo@localhost;
create procedure rootonly() select 1;
create sql security definer view v1d as select current_user(),user from information_schema.processlist where command!='daemon';
create sql security invoker view v1i as select current_user(),user from information_schema.processlist where command!='daemon';
create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
create sql security invoker view v3i as select schema_name from information_schema.schemata where schema_name like '%mysql%';
create sql security definer view v4d as select routine_name from information_schema.routines where routine_schema='test';
create sql security invoker view v4i as select routine_name from information_schema.routines where routine_schema='test';
create sql security definer view v5d as select view_definition > '' from information_schema.views where table_name='v1d';
create sql security invoker view v5i as select view_definition > '' from information_schema.views where table_name='v1d';
connect foo,localhost,foo;
select * from v1d;
select * from v1i;
select * from v2d;
select * from v2i;
select * from v3d;
select * from v3i;
select * from v4d;
select * from v4i;
select * from v5d;
select * from v5i;
connection default;
select * from v1d;
select * from v1i;
select * from v2d;
select * from v2i;
select * from v3d;
select * from v3i;
select * from v4d;
select * from v4i;
select * from v5d;
select * from v5i;
disconnect foo;
drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
drop user foo@localhost;
drop procedure rootonly;
--enable_service_connection
--echo #
--echo # End of 10.2 tests
--echo #
--echo #
--echo # MDEV-32500 Information schema leaks table names and structure to unauthorized users
--echo #
create database db;
create table db.t1 (x int, key(x)) engine=InnoDB;
create table db.t2 (a int, b int, c int, unique(b), check(c>b), foreign key(c) references db.t1(x)) engine=InnoDB;
create table db.t3 (d int, e int, f int, unique(e), check(f>e), foreign key(f) references db.t1(x),
foreign key(e) references db.t2(b),
foreign key(d) references db.t3(f)
) engine=InnoDB;
create user u@localhost;
grant select (a) on db.t2 to u@localhost;
grant update (d) on db.t3 to u@localhost;
--connect con1,localhost,u,,db
--sorted_result
select table_name, column_name from information_schema.columns where table_name like 't_';
select table_name, column_name from information_schema.key_column_usage where table_name like 't_';
select table_name, unique_constraint_name, referenced_table_name from information_schema.referential_constraints where table_name like 't_';
select table_name, constraint_name, constraint_type from information_schema.table_constraints where table_name like 't_';
show index in t2;
show index in t3;
--disconnect con1
--connection default
drop user u@localhost;
drop database db;
--echo #
--echo # End of 10.4 tests
--echo #