mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
f7cf76fc80
into mysql.com:/home/my/mysql-5.1 BitKeeper/deleted/.del-innodb_notembedded.test: Delete: mysql-test/t/innodb_notembedded.test BitKeeper/deleted/.del-sp_notembedded.test: Delete: mysql-test/t/sp_notembedded.test BitKeeper/deleted/.del-subselect_notembedded.test: Delete: mysql-test/t/subselect_notembedded.test BitKeeper/deleted/.del-ctype_cp932_notembedded.result: Delete: mysql-test/r/ctype_cp932_notembedded.result BitKeeper/deleted/.del-innodb_notembedded.result: Delete: mysql-test/r/innodb_notembedded.result BitKeeper/deleted/.del-sp_notembedded.result: Delete: mysql-test/r/sp_notembedded.result BitKeeper/deleted/.del-subselect_notembedded.result: Delete: mysql-test/r/subselect_notembedded.result configure.in: Auto merged include/mysql.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/emb_qcache.cc: Auto merged libmysqld/embedded_priv.h: Auto merged libmysqld/libmysqld.c: Auto merged mysql-test/extra/binlog_tests/blackhole.test: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/mysqltest.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/query_cache_notembedded.result: Auto merged mysql-test/r/sp-error.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/r/view_grant.result: Auto merged mysql-test/t/backup.test: Auto merged mysql-test/t/compress.test: Auto merged mysql-test/t/delayed.test: Auto merged mysql-test/t/handler.test: Auto merged mysql-test/t/mysql.test: Auto merged mysql-test/t/mysql_client_test.test: Auto merged mysql-test/t/mysqltest.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/query_cache_notembedded.test: Auto merged mysql-test/t/read_only.test: Auto merged mysql-test/t/skip_grants.test: Auto merged mysql-test/t/sp-destruct.test: Auto merged mysql-test/t/sp-error.test: Auto merged mysql-test/t/sp-threads.test: Auto merged mysql-test/t/sp.test: Auto merged mysql-test/t/temp_table.test: Auto merged mysql-test/t/view_grant.test: Auto merged mysql-test/t/wait_timeout.test: Auto merged mysys/mf_dirname.c: Auto merged sql/field.cc: Auto merged sql/handler.h: Auto merged sql/item.h: Auto merged sql/log_event.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_cursor.cc: Auto merged sql/sql_db.cc: Auto merged sql-common/client.c: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.h: Auto merged sql/table.h: Auto merged sql/tztime.cc: Auto merged sql/tztime.h: Auto merged storage/ndb/include/ndbapi/NdbDictionary.hpp: Auto merged tests/mysql_client_test.c: Auto merged libmysqld/lib_sql.cc: Manual merge mysql-test/extra/binlog_tests/binlog.test: Manual merge mysql-test/extra/binlog_tests/ctype_cp932.test: No changes mysql-test/r/binlog_stm_binlog.result: Manual merge mysql-test/r/binlog_stm_ctype_cp932.result: No changes mysql-test/t/innodb.test: Manual merge mysql-test/t/view.test: Manual merge mysys/my_bitmap.c: Manual merge scripts/mysql_fix_privilege_tables.sql: Manual merge sql/item.cc: Manual merge sql/sql_cache.h: Manual merge sql/sql_class.h: Manual merge sql/sql_update.cc: Manual merge
144 lines
4.1 KiB
Text
144 lines
4.1 KiB
Text
#
|
|
# Destructive stored procedure tests
|
|
#
|
|
# We do horrible things to the mysql.proc table here, so any unexpected
|
|
# failures here might leave it in an undetermined state.
|
|
#
|
|
# In the case of trouble you might want to skip this.
|
|
#
|
|
|
|
# embedded server returns different paths in error messages
|
|
# in lines like 'call bug14233();'
|
|
# mysqltest should be fixed to allow REPLACE_RESULT in error message
|
|
-- source include/not_embedded.inc
|
|
|
|
# We're using --system things that probably doesn't work on Windows.
|
|
--source include/not_windows.inc
|
|
|
|
# Backup proc table
|
|
--system rm -rf $MYSQLTEST_VARDIR/master-data/mysql/backup
|
|
--system mkdir $MYSQLTEST_VARDIR/master-data/mysql/backup
|
|
--system cp $MYSQLTEST_VARDIR/master-data/mysql/proc.* $MYSQLTEST_VARDIR/master-data/mysql/backup/
|
|
|
|
use test;
|
|
|
|
--disable_warnings
|
|
drop procedure if exists bug14233;
|
|
drop function if exists bug14233;
|
|
drop table if exists t1;
|
|
drop view if exists v1;
|
|
--enable_warnings
|
|
|
|
create procedure bug14233()
|
|
set @x = 42;
|
|
|
|
create function bug14233_f() returns int
|
|
return 42;
|
|
|
|
create table t1 (id int);
|
|
create trigger t1_ai after insert on t1 for each row call bug14233();
|
|
|
|
# Unsupported tampering with the mysql.proc definition
|
|
alter table mysql.proc drop type;
|
|
--replace_result $MYSQL_TEST_DIR .
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
call bug14233();
|
|
--replace_result $MYSQL_TEST_DIR .
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
create view v1 as select bug14233_f();
|
|
--replace_result $MYSQL_TEST_DIR .
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
insert into t1 values (0);
|
|
|
|
flush table mysql.proc;
|
|
|
|
# Thrashing the .frm file
|
|
--system echo 'saljdlfa' > $MYSQLTEST_VARDIR/master-data/mysql/proc.frm
|
|
--replace_result $MYSQLTEST_VARDIR . master-data// ''
|
|
--error ER_NOT_FORM_FILE
|
|
call bug14233();
|
|
--replace_result $MYSQLTEST_VARDIR . master-data// ''
|
|
--error ER_NOT_FORM_FILE
|
|
create view v1 as select bug14233_f();
|
|
--replace_result $MYSQLTEST_VARDIR . master-data// ''
|
|
--error ER_NOT_FORM_FILE
|
|
insert into t1 values (0);
|
|
|
|
|
|
flush table mysql.proc;
|
|
|
|
# Drop the mysql.proc table
|
|
--system rm $MYSQLTEST_VARDIR/master-data/mysql/proc.*
|
|
--error ER_NO_SUCH_TABLE
|
|
call bug14233();
|
|
--error ER_NO_SUCH_TABLE
|
|
create view v1 as select bug14233_f();
|
|
--error ER_NO_SUCH_TABLE
|
|
insert into t1 values (0);
|
|
|
|
# Restore mysql.proc
|
|
--system mv $MYSQLTEST_VARDIR/master-data/mysql/backup/* $MYSQLTEST_VARDIR/master-data/mysql/
|
|
--system rmdir $MYSQLTEST_VARDIR/master-data/mysql/backup
|
|
|
|
flush table mysql.proc;
|
|
flush privileges;
|
|
|
|
delete from mysql.proc where name like 'bug14233%';
|
|
|
|
# Unsupported editing of mysql.proc, circumventing checks in "create ..."
|
|
insert into mysql.proc
|
|
(
|
|
db, name, type, specific_name, language, sql_data_access, is_deterministic,
|
|
security_type, param_list, returns, body, definer, created, modified,
|
|
sql_mode, comment
|
|
)
|
|
values
|
|
(
|
|
'test', 'bug14233_1', 'FUNCTION', 'bug14233_1', 'SQL', 'READS_SQL_DATA', 'NO',
|
|
'DEFINER', '', 'int(10)',
|
|
'select count(*) from mysql.user',
|
|
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
|
|
),
|
|
(
|
|
'test', 'bug14233_2', 'FUNCTION', 'bug14233_2', 'SQL', 'READS_SQL_DATA', 'NO',
|
|
'DEFINER', '', 'int(10)',
|
|
'begin declare x int; select count(*) into x from mysql.user; end',
|
|
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
|
|
),
|
|
(
|
|
'test', 'bug14233_3', 'PROCEDURE', 'bug14233_3', 'SQL', 'READS_SQL_DATA','NO',
|
|
'DEFINER', '', '',
|
|
'alksj wpsj sa ^#!@ ',
|
|
'root@localhost', NOW() , '0000-00-00 00:00:00', '', ''
|
|
);
|
|
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
select bug14233_1();
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
create view v1 as select bug14233_1();
|
|
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
select bug14233_2();
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
create view v1 as select bug14233_2();
|
|
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
call bug14233_3();
|
|
drop trigger t1_ai;
|
|
create trigger t1_ai after insert on t1 for each row call bug14233_3();
|
|
--error ER_SP_PROC_TABLE_CORRUPT
|
|
insert into t1 values (0);
|
|
|
|
# Clean-up
|
|
drop trigger t1_ai;
|
|
drop table t1;
|
|
|
|
#
|
|
# BUG#16303: erroneus stored procedures and functions should be droppable
|
|
#
|
|
drop function bug14233_1;
|
|
drop function bug14233_2;
|
|
drop procedure bug14233_3;
|
|
# Assert: These should show nothing.
|
|
show procedure status;
|
|
show function status;
|