Commit da8b9967 authored by unknown's avatar unknown
Browse files

this has nothing to do with the bug#13012.

it's about mysql_admin_commands not being reexecution-safe
(and CHECK still isn't)


mysql-test/r/sp-error.result:
  optimize is now allowed in SP
mysql-test/r/sp.result:
  test repair/optimize/analyze in SP
mysql-test/t/backup.test:
  clean up after itself
mysql-test/t/sp-error.test:
  optimize is now allowed in SP
mysql-test/t/sp.test:
  test repair/optimize/analyze in SP
sql/sp_head.cc:
  all mysql_admin commands return result set
sql/sql_parse.cc:
  all mysql_admin commands modify table list and we should restore it for SP
sql/sql_table.cc:
  optimization - don't execute views when no view is expected/allowed
sql/sql_yacc.yy:
  optimize is now allowed in SP
parent 33b58ea1
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -768,7 +768,7 @@ BEGIN
OPTIMIZE TABLE t1;
RETURN 1;
END|
ERROR 0A000: OPTIMIZE TABLE is not allowed in stored procedures
ERROR 0A000: Not allowed to return a result set from a function
DROP FUNCTION IF EXISTS bug12995|
CREATE FUNCTION bug12995() RETURNS INT
BEGIN
+63 −0
Original line number Diff line number Diff line
@@ -4168,6 +4168,69 @@ test.t1 backup status OK
Table	Op	Msg_type	Msg_text
test.t1	restore	status	OK
drop procedure bug13012|
create view v1 as select * from t1|
create procedure bug13012()
BEGIN
REPAIR TABLE t1,t2,t3,v1;
OPTIMIZE TABLE t1,t2,t3,v1;
ANALYZE TABLE t1,t2,t3,v1;
END|
call bug13012()|
Table	Op	Msg_type	Msg_text
test.t1	repair	status	OK
test.t2	repair	status	OK
test.t3	repair	error	Table 'test.t3' doesn't exist
test.v1	repair	note	Unknown table 'test.v1'
Table	Op	Msg_type	Msg_text
test.t1	optimize	status	OK
test.t2	optimize	status	OK
test.t3	optimize	error	Table 'test.t3' doesn't exist
test.v1	optimize	note	Unknown table 'test.v1'
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	Table is already up to date
test.t2	analyze	status	Table is already up to date
test.t3	analyze	error	Table 'test.t3' doesn't exist
test.v1	analyze	note	Unknown table 'test.v1'
Warnings:
Error	1146	Table 'test.t3' doesn't exist
call bug13012()|
Table	Op	Msg_type	Msg_text
test.t1	repair	status	OK
test.t2	repair	status	OK
test.t3	repair	error	Table 'test.t3' doesn't exist
test.v1	repair	note	Unknown table 'test.v1'
Table	Op	Msg_type	Msg_text
test.t1	optimize	status	OK
test.t2	optimize	status	OK
test.t3	optimize	error	Table 'test.t3' doesn't exist
test.v1	optimize	note	Unknown table 'test.v1'
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	Table is already up to date
test.t2	analyze	status	Table is already up to date
test.t3	analyze	error	Table 'test.t3' doesn't exist
test.v1	analyze	note	Unknown table 'test.v1'
Warnings:
Error	1146	Table 'test.t3' doesn't exist
call bug13012()|
Table	Op	Msg_type	Msg_text
test.t1	repair	status	OK
test.t2	repair	status	OK
test.t3	repair	error	Table 'test.t3' doesn't exist
test.v1	repair	note	Unknown table 'test.v1'
Table	Op	Msg_type	Msg_text
test.t1	optimize	status	OK
test.t2	optimize	status	OK
test.t3	optimize	error	Table 'test.t3' doesn't exist
test.v1	optimize	note	Unknown table 'test.v1'
Table	Op	Msg_type	Msg_text
test.t1	analyze	status	Table is already up to date
test.t2	analyze	status	Table is already up to date
test.t3	analyze	error	Table 'test.t3' doesn't exist
test.v1	analyze	note	Unknown table 'test.v1'
Warnings:
Error	1146	Table 'test.t3' doesn't exist
drop procedure bug13012|
drop view v1;
select * from t1|
a
a - table column
+1 −0
Original line number Diff line number Diff line
@@ -52,5 +52,6 @@ unlock tables;
connection con1;
reap;
drop table t5;
--system rm $MYSQL_TEST_DIR/var/tmp/t?.*

# End of 4.1 tests
+1 −1
Original line number Diff line number Diff line
@@ -1095,7 +1095,7 @@ delimiter |;
--disable_warnings
DROP FUNCTION IF EXISTS bug12953|
--enable_warnings
--error ER_SP_BADSTATEMENT
--error ER_SP_NO_RETSET
CREATE FUNCTION bug12953() RETURNS INT
BEGIN
  OPTIMIZE TABLE t1;
+12 −1
Original line number Diff line number Diff line
@@ -4961,9 +4961,20 @@ BEGIN
  DROP TABLE t1;
  RESTORE TABLE t1 FROM '../tmp';
END|
--replace_result ": 7" ": X" ": 17" ": X" $MYSQL_TEST_DIR MYSQL_TEST_DIR
call bug13012()|
drop procedure bug13012|
create view v1 as select * from t1|
create procedure bug13012()
BEGIN
  REPAIR TABLE t1,t2,t3,v1;
  OPTIMIZE TABLE t1,t2,t3,v1;
  ANALYZE TABLE t1,t2,t3,v1;
END|
call bug13012()|
call bug13012()|
call bug13012()|
drop procedure bug13012|
drop view v1;
select * from t1|

#
Loading