Commit 6cf8483d authored by unknown's avatar unknown

merged


mysql-test/t/sp.test:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
parents f095abaa c34e0817
...@@ -341,6 +341,7 @@ long SSL_CTX_sess_set_cache_size(SSL_CTX*, long); ...@@ -341,6 +341,7 @@ long SSL_CTX_sess_set_cache_size(SSL_CTX*, long);
long SSL_CTX_set_tmp_dh(SSL_CTX*, DH*); long SSL_CTX_set_tmp_dh(SSL_CTX*, DH*);
void OpenSSL_add_all_algorithms(void); void OpenSSL_add_all_algorithms(void);
void SSL_library_init();
void SSLeay_add_ssl_algorithms(void); void SSLeay_add_ssl_algorithms(void);
......
...@@ -648,6 +648,10 @@ void OpenSSL_add_all_algorithms() // compatibility only ...@@ -648,6 +648,10 @@ void OpenSSL_add_all_algorithms() // compatibility only
{} {}
void SSL_library_init() // compatibility only
{}
DH* DH_new(void) DH* DH_new(void)
{ {
DH* dh = new (ys) DH; DH* dh = new (ys) DH;
......
...@@ -117,6 +117,9 @@ typedef unsigned long long my_ulonglong; ...@@ -117,6 +117,9 @@ typedef unsigned long long my_ulonglong;
#define MYSQL_COUNT_ERROR (~(my_ulonglong) 0) #define MYSQL_COUNT_ERROR (~(my_ulonglong) 0)
/* backward compatibility define - to be removed eventually */
#define ER_WARN_DATA_TRUNCATED WARN_DATA_TRUNCATED
typedef struct st_mysql_rows { typedef struct st_mysql_rows {
struct st_mysql_rows *next; /* list of rows */ struct st_mysql_rows *next; /* list of rows */
MYSQL_ROW data; MYSQL_ROW data;
......
...@@ -768,7 +768,7 @@ BEGIN ...@@ -768,7 +768,7 @@ BEGIN
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
RETURN 1; RETURN 1;
END| 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| DROP FUNCTION IF EXISTS bug12995|
CREATE FUNCTION bug12995() RETURNS INT CREATE FUNCTION bug12995() RETURNS INT
BEGIN BEGIN
...@@ -981,6 +981,8 @@ END | ...@@ -981,6 +981,8 @@ END |
drop table t1| drop table t1|
drop function bug_13627_f| drop function bug_13627_f|
drop function if exists bug12329; drop function if exists bug12329;
Warnings:
Note 1305 FUNCTION bug12329 does not exist
create table t1 as select 1 a; create table t1 as select 1 a;
create table t2 as select 1 a; create table t2 as select 1 a;
create function bug12329() returns int return (select a from t1); create function bug12329() returns int return (select a from t1);
...@@ -1055,3 +1057,34 @@ Db Name Type Definer Modified Created Security_type Comment ...@@ -1055,3 +1057,34 @@ Db Name Type Definer Modified Created Security_type Comment
mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER mysqltest2 p1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
drop database mysqltest2; drop database mysqltest2;
use test; use test;
DROP FUNCTION IF EXISTS bug13012|
CREATE FUNCTION bug13012() RETURNS INT
BEGIN
REPAIR TABLE t1;
RETURN 1;
END|
ERROR 0A000: Not allowed to return a result set from a function
CREATE FUNCTION bug13012() RETURNS INT
BEGIN
BACKUP TABLE t1 TO '/tmp';
RETURN 1;
END|
ERROR 0A000: Not allowed to return a result set from a function
CREATE FUNCTION bug13012() RETURNS INT
BEGIN
RESTORE TABLE t1 FROM '/tmp';
RETURN 1;
END|
ERROR 0A000: Not allowed to return a result set from a function
create table t1 (a int)|
CREATE PROCEDURE bug13012_1() REPAIR TABLE t1|
CREATE FUNCTION bug13012_2() RETURNS INT
BEGIN
CALL bug13012_1();
RETURN 1;
END|
SELECT bug13012_2()|
ERROR 0A000: Not allowed to return a result set from a function
drop table t1|
drop procedure bug13012_1|
drop function bug13012_2|
...@@ -4100,8 +4100,6 @@ x ...@@ -4100,8 +4100,6 @@ x
4711 4711
drop procedure bug14376| drop procedure bug14376|
drop procedure if exists p1| drop procedure if exists p1|
Warnings:
Note 1305 PROCEDURE p1 does not exist
drop table if exists t1| drop table if exists t1|
create table t1 (a varchar(255))| create table t1 (a varchar(255))|
insert into t1 (a) values ("a - table column")| insert into t1 (a) values ("a - table column")|
...@@ -4153,6 +4151,89 @@ A local variable in a nested compound statement takes precedence over table colu ...@@ -4153,6 +4151,89 @@ A local variable in a nested compound statement takes precedence over table colu
a - local variable in a nested compound statement a - local variable in a nested compound statement
A local variable in a nested compound statement takes precedence over table column in cursors A local variable in a nested compound statement takes precedence over table column in cursors
a - local variable in a nested compound statement a - local variable in a nested compound statement
drop procedure p1|
drop procedure if exists bug13012|
create procedure bug13012()
BEGIN
REPAIR TABLE t1;
BACKUP TABLE t1 to '../tmp';
DROP TABLE t1;
RESTORE TABLE t1 FROM '../tmp';
END|
call bug13012()|
Table Op Msg_type Msg_text
test.t1 repair status OK
Table Op Msg_type Msg_text
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 error 'test.v1' is not BASE TABLE
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 error 'test.v1' is not BASE TABLE
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 error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
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 error 'test.v1' is not BASE TABLE
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 error 'test.v1' is not BASE TABLE
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 error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
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 error 'test.v1' is not BASE TABLE
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 error 'test.v1' is not BASE TABLE
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 error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
drop procedure bug13012|
drop view v1;
select * from t1|
a
a - table column
drop schema if exists mysqltest1| drop schema if exists mysqltest1|
Warnings: Warnings:
Note 1008 Can't drop database 'mysqltest1'; database doesn't exist Note 1008 Can't drop database 'mysqltest1'; database doesn't exist
......
...@@ -2383,20 +2383,25 @@ CREATE TABLE t1(id INT); ...@@ -2383,20 +2383,25 @@ CREATE TABLE t1(id INT);
CREATE VIEW v1 AS SELECT id FROM t1; CREATE VIEW v1 AS SELECT id FROM t1;
OPTIMIZE TABLE v1; OPTIMIZE TABLE v1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.v1 optimize note Unknown table 'test.v1' test.v1 optimize error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
ANALYZE TABLE v1; ANALYZE TABLE v1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.v1 analyze note Unknown table 'test.v1' test.v1 analyze error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
REPAIR TABLE v1; REPAIR TABLE v1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.v1 repair note Unknown table 'test.v1' test.v1 repair error 'test.v1' is not BASE TABLE
Warnings:
Error 1347 'test.v1' is not BASE TABLE
DROP TABLE t1; DROP TABLE t1;
OPTIMIZE TABLE v1; OPTIMIZE TABLE v1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.v1 optimize note Unknown table 'test.v1' test.v1 optimize error 'test.v1' is not BASE TABLE
Warnings: Warnings:
Error 1146 Table 'test.t1' doesn't exist Error 1347 'test.v1' is not BASE TABLE
Error 1356 View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
DROP VIEW v1; DROP VIEW v1;
create definer = current_user() sql security invoker view v1 as select 1; create definer = current_user() sql security invoker view v1 as select 1;
show create view v1; show create view v1;
......
...@@ -52,5 +52,6 @@ unlock tables; ...@@ -52,5 +52,6 @@ unlock tables;
connection con1; connection con1;
reap; reap;
drop table t5; drop table t5;
--system rm $MYSQL_TEST_DIR/var/tmp/t?.*
# End of 4.1 tests # End of 4.1 tests
...@@ -1095,7 +1095,7 @@ delimiter |; ...@@ -1095,7 +1095,7 @@ delimiter |;
--disable_warnings --disable_warnings
DROP FUNCTION IF EXISTS bug12953| DROP FUNCTION IF EXISTS bug12953|
--enable_warnings --enable_warnings
--error ER_SP_BADSTATEMENT --error ER_SP_NO_RETSET
CREATE FUNCTION bug12953() RETURNS INT CREATE FUNCTION bug12953() RETURNS INT
BEGIN BEGIN
OPTIMIZE TABLE t1; OPTIMIZE TABLE t1;
...@@ -1410,7 +1410,6 @@ delimiter ;| ...@@ -1410,7 +1410,6 @@ delimiter ;|
# BUG#12329: "Bogus error msg when executing PS with stored procedure after # BUG#12329: "Bogus error msg when executing PS with stored procedure after
# SP was re-created". See also test for related bug#13399 in trigger.test # SP was re-created". See also test for related bug#13399 in trigger.test
--disable_warnings
drop function if exists bug12329; drop function if exists bug12329;
--enable_warnings --enable_warnings
create table t1 as select 1 a; create table t1 as select 1 a;
...@@ -1518,6 +1517,44 @@ show procedure status; ...@@ -1518,6 +1517,44 @@ show procedure status;
drop database mysqltest2; drop database mysqltest2;
use test; use test;
#
# Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server"
#
delimiter |;
--disable_warnings
DROP FUNCTION IF EXISTS bug13012|
--enable_warnings
--error ER_SP_NO_RETSET
CREATE FUNCTION bug13012() RETURNS INT
BEGIN
REPAIR TABLE t1;
RETURN 1;
END|
--error ER_SP_NO_RETSET
CREATE FUNCTION bug13012() RETURNS INT
BEGIN
BACKUP TABLE t1 TO '/tmp';
RETURN 1;
END|
--error ER_SP_NO_RETSET
CREATE FUNCTION bug13012() RETURNS INT
BEGIN
RESTORE TABLE t1 FROM '/tmp';
RETURN 1;
END|
create table t1 (a int)|
CREATE PROCEDURE bug13012_1() REPAIR TABLE t1|
CREATE FUNCTION bug13012_2() RETURNS INT
BEGIN
CALL bug13012_1();
RETURN 1;
END|
--error ER_SP_NO_RETSET
SELECT bug13012_2()|
drop table t1|
drop procedure bug13012_1|
drop function bug13012_2|
delimiter ;|
# BUG#NNNN: New bug synopsis # BUG#NNNN: New bug synopsis
# #
......
...@@ -4910,8 +4910,10 @@ drop procedure bug14376| ...@@ -4910,8 +4910,10 @@ drop procedure bug14376|
# variable declarations. In MySQL 5.0 it's vice versa. # variable declarations. In MySQL 5.0 it's vice versa.
# #
--disable_warnings
drop procedure if exists p1| drop procedure if exists p1|
drop table if exists t1| drop table if exists t1|
--enable_warnings
create table t1 (a varchar(255))| create table t1 (a varchar(255))|
insert into t1 (a) values ("a - table column")| insert into t1 (a) values ("a - table column")|
create procedure p1(a varchar(255)) create procedure p1(a varchar(255))
...@@ -4946,6 +4948,36 @@ begin ...@@ -4946,6 +4948,36 @@ begin
end; end;
end| end|
call p1("a - stored procedure parameter")| call p1("a - stored procedure parameter")|
drop procedure p1|
#
# Bug#13012 "SP: REPAIR/BACKUP/RESTORE TABLE crashes the server"
#
--disable_warnings
drop procedure if exists bug13012|
--enable_warnings
create procedure bug13012()
BEGIN
REPAIR TABLE t1;
BACKUP TABLE t1 to '../tmp';
DROP TABLE t1;
RESTORE TABLE t1 FROM '../tmp';
END|
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|
# #
# A test case for Bug#15392 "Server crashes during prepared statement # A test case for Bug#15392 "Server crashes during prepared statement
......
...@@ -4590,7 +4590,7 @@ ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 21000 ...@@ -4590,7 +4590,7 @@ ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT 21000
nla "De gebruikte SELECT commando's hebben een verschillend aantal kolommen" nla "De gebruikte SELECT commando's hebben een verschillend aantal kolommen"
eng "The used SELECT statements have a different number of columns" eng "The used SELECT statements have a different number of columns"
est "Tulpade arv kasutatud SELECT lausetes ei kattu" est "Tulpade arv kasutatud SELECT lausetes ei kattu"
ger "Die verwendeten SELECT-Befehle liefern eine unterschiedliche Anzahl von Feldern zurck" ger "Die verwendeten SELECT-Befehle liefern unterschiedliche Anzahlen von Feldern zurck"
ita "La SELECT utilizzata ha un numero di colonne differente" ita "La SELECT utilizzata ha un numero di colonne differente"
por "Os comandos SELECT usados tm diferente nmero de colunas" por "Os comandos SELECT usados tm diferente nmero de colunas"
rus " (SELECT) " rus " (SELECT) "
...@@ -5274,7 +5274,7 @@ ER_VIEW_SELECT_TMPTABLE ...@@ -5274,7 +5274,7 @@ ER_VIEW_SELECT_TMPTABLE
ukr "View SELECT դ '%-.64s'" ukr "View SELECT դ '%-.64s'"
ER_VIEW_WRONG_LIST ER_VIEW_WRONG_LIST
eng "View's SELECT and view's field list have different column counts" eng "View's SELECT and view's field list have different column counts"
ger "SELECT- und Feldliste der Views haben eine unterschiedliche Anzahl von Spalten" ger "SELECT- und Feldliste der Views haben unterschiedliche Anzahlen von Spalten"
rus "View SELECT view " rus "View SELECT view "
ukr "View SELECT ̦ æ view Ҧ ˦˦ æ" ukr "View SELECT ̦ æ view Ҧ ˦˦ æ"
ER_WARN_VIEW_MERGE ER_WARN_VIEW_MERGE
...@@ -5485,7 +5485,7 @@ ER_CANT_CREATE_GEOMETRY_OBJECT 22003 ...@@ -5485,7 +5485,7 @@ ER_CANT_CREATE_GEOMETRY_OBJECT 22003
ger "Kann kein Geometrieobjekt aus den Daten machen, die Sie dem GEOMETRY-Feld bergeben haben" ger "Kann kein Geometrieobjekt aus den Daten machen, die Sie dem GEOMETRY-Feld bergeben haben"
ER_FAILED_ROUTINE_BREAK_BINLOG ER_FAILED_ROUTINE_BREAK_BINLOG
eng "A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes" eng "A routine failed and has neither NO SQL nor READS SQL DATA in its declaration and binary logging is enabled; if non-transactional tables were updated, the binary log will miss their changes"
ger "Eine Routine, die weder NO SQL noch READS SQL DATA in der Deklaration hat, schlug fehl und Binrlogging ist aktiv. Wenn Nicht-Transaktions-Tabellen atualisiert wurden, enthlt das Binrlog ihre nderungen nicht" ger "Eine Routine, die weder NO SQL noch READS SQL DATA in der Deklaration hat, schlug fehl und Binrlogging ist aktiv. Wenn Nicht-Transaktions-Tabellen aktualisiert wurden, enthlt das Binrlog ihre nderungen nicht"
ER_BINLOG_UNSAFE_ROUTINE ER_BINLOG_UNSAFE_ROUTINE
eng "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)" eng "This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)"
ger "Diese Routine hat weder DETERMINISTIC, NO SQL noch READS SQL DATA in der Deklaration und Binrlogging ist aktiv (*vielleicht* sollten Sie die weniger sichere Variable log_bin_trust_routine_creators verwenden)" ger "Diese Routine hat weder DETERMINISTIC, NO SQL noch READS SQL DATA in der Deklaration und Binrlogging ist aktiv (*vielleicht* sollten Sie die weniger sichere Variable log_bin_trust_routine_creators verwenden)"
...@@ -5595,10 +5595,13 @@ ER_SP_BAD_VAR_SHADOW 42000 ...@@ -5595,10 +5595,13 @@ ER_SP_BAD_VAR_SHADOW 42000
eng "Variable '%-.64s' must be quoted with `...`, or renamed" eng "Variable '%-.64s' must be quoted with `...`, or renamed"
ger "Variable '%-.64s' muss mit `...` geschtzt oder aber umbenannt werden" ger "Variable '%-.64s' muss mit `...` geschtzt oder aber umbenannt werden"
ER_TRG_NO_DEFINER ER_TRG_NO_DEFINER
eng "No definer attribute for trigger '%-.64s'.'%-.64s'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger." eng "No definer attribute for trigger '%-.64s'.'%-.64s'. The trigger will be activated under the authorization of the invoker, which may have insufficient privileges. Please recreate the trigger."
ger "Kein Definierer-Attribut fr Trigger '%-.64s'.'%-.64s'. Der Trigger wird mit der Autorisierung des Aufrufers aktiviert, der mglicherweise keine zureichenden Berechtigungen hat. Bitte legen Sie den Trigger neu an."
ER_OLD_FILE_FORMAT ER_OLD_FILE_FORMAT
eng "'%-.64s' has an old format, you should re-create the '%s' object(s)" eng "'%-.64s' has an old format, you should re-create the '%s' object(s)"
ger "'%-.64s' hat altes Format, Sie sollten die '%s'-Objekt(e) neu erzeugen"
ER_SP_RECURSION_LIMIT ER_SP_RECURSION_LIMIT
eng "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.64s" eng "Recursive limit %d (as set by the max_sp_recursion_depth variable) was exceeded for routine %.64s"
ger "Rekursionsgrenze %d (durch Variable max_sp_recursion_depth gegeben) wurde fr Routine %.64s berschritten"
ER_SP_PROC_TABLE_CORRUPT ER_SP_PROC_TABLE_CORRUPT
eng "Failed to load routine %s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)" eng "Failed to load routine %s. The table mysql.proc is missing, corrupt, or contains bad data (internal code %d)"
...@@ -72,7 +72,11 @@ sp_get_flags_for_command(LEX *lex) ...@@ -72,7 +72,11 @@ sp_get_flags_for_command(LEX *lex)
} }
/* fallthrough */ /* fallthrough */
case SQLCOM_ANALYZE: case SQLCOM_ANALYZE:
case SQLCOM_OPTIMIZE:
case SQLCOM_PRELOAD_KEYS:
case SQLCOM_ASSIGN_TO_KEYCACHE:
case SQLCOM_CHECKSUM: case SQLCOM_CHECKSUM:
case SQLCOM_CHECK:
case SQLCOM_HA_READ: case SQLCOM_HA_READ:
case SQLCOM_SHOW_BINLOGS: case SQLCOM_SHOW_BINLOGS:
case SQLCOM_SHOW_BINLOG_EVENTS: case SQLCOM_SHOW_BINLOG_EVENTS:
...@@ -107,6 +111,9 @@ sp_get_flags_for_command(LEX *lex) ...@@ -107,6 +111,9 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_WARNS: case SQLCOM_SHOW_WARNS:
case SQLCOM_SHOW_PROC_CODE: case SQLCOM_SHOW_PROC_CODE:
case SQLCOM_SHOW_FUNC_CODE: case SQLCOM_SHOW_FUNC_CODE:
case SQLCOM_REPAIR:
case SQLCOM_BACKUP_TABLE:
case SQLCOM_RESTORE_TABLE:
flags= sp_head::MULTI_RESULTS; flags= sp_head::MULTI_RESULTS;
break; break;
/* /*
......
...@@ -2617,7 +2617,8 @@ mysql_execute_command(THD *thd) ...@@ -2617,7 +2617,8 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements; thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_backup_table(thd, first_table); res = mysql_backup_table(thd, first_table);
(TABLE_LIST*) select_lex->table_list.first=first_table;
lex->query_tables=all_tables;
break; break;
} }
case SQLCOM_RESTORE_TABLE: case SQLCOM_RESTORE_TABLE:
...@@ -2629,6 +2630,8 @@ mysql_execute_command(THD *thd) ...@@ -2629,6 +2630,8 @@ mysql_execute_command(THD *thd)
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements; thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_restore_table(thd, first_table); res = mysql_restore_table(thd, first_table);
(TABLE_LIST*) select_lex->table_list.first=first_table;
lex->query_tables=all_tables;
break; break;
} }
case SQLCOM_ASSIGN_TO_KEYCACHE: case SQLCOM_ASSIGN_TO_KEYCACHE:
...@@ -3131,6 +3134,8 @@ end_with_restore_list: ...@@ -3131,6 +3134,8 @@ end_with_restore_list:
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
} }
(TABLE_LIST*) select_lex->table_list.first=first_table;
lex->query_tables=all_tables;
break; break;
} }
case SQLCOM_CHECK: case SQLCOM_CHECK:
...@@ -3141,6 +3146,8 @@ end_with_restore_list: ...@@ -3141,6 +3146,8 @@ end_with_restore_list:
goto error; /* purecov: inspected */ goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements; thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_check_table(thd, first_table, &lex->check_opt); res = mysql_check_table(thd, first_table, &lex->check_opt);
(TABLE_LIST*) select_lex->table_list.first=first_table;
lex->query_tables=all_tables;
break; break;
} }
case SQLCOM_ANALYZE: case SQLCOM_ANALYZE:
...@@ -3161,6 +3168,8 @@ end_with_restore_list: ...@@ -3161,6 +3168,8 @@ end_with_restore_list:
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
} }
(TABLE_LIST*) select_lex->table_list.first=first_table;
lex->query_tables=all_tables;
break; break;
} }
...@@ -3184,6 +3193,8 @@ end_with_restore_list: ...@@ -3184,6 +3193,8 @@ end_with_restore_list:
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
} }
(TABLE_LIST*) select_lex->table_list.first=first_table;
lex->query_tables=all_tables;
break; break;
} }
case SQLCOM_UPDATE: case SQLCOM_UPDATE:
......
...@@ -2222,18 +2222,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, ...@@ -2222,18 +2222,14 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
*/ */
lex->query_tables= table; lex->query_tables= table;
lex->query_tables_last= &table->next_global; lex->query_tables_last= &table->next_global;
lex->query_tables_own_last= 0;; lex->query_tables_own_last= 0;
thd->no_warnings_for_error= no_warnings_for_error; thd->no_warnings_for_error= no_warnings_for_error;
if (view_operator_func == NULL)
table->required_type=FRMTYPE_TABLE;
open_and_lock_tables(thd, table); open_and_lock_tables(thd, table);
thd->no_warnings_for_error= 0; thd->no_warnings_for_error= 0;
table->next_global= save_next_global; table->next_global= save_next_global;
table->next_local= save_next_local; table->next_local= save_next_local;
/* if view are unsupported */
if (table->view && view_operator_func == NULL)
{
result_code= HA_ADMIN_NOT_BASE_TABLE;
goto send_result;
}
thd->open_options&= ~extra_open_options; thd->open_options&= ~extra_open_options;
if (prepare_func) if (prepare_func)
......
...@@ -3783,11 +3783,6 @@ optimize: ...@@ -3783,11 +3783,6 @@ optimize:
OPTIMIZE opt_no_write_to_binlog table_or_tables OPTIMIZE opt_no_write_to_binlog table_or_tables
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "OPTIMIZE TABLE");
YYABORT;
}
lex->sql_command = SQLCOM_OPTIMIZE; lex->sql_command = SQLCOM_OPTIMIZE;
lex->no_write_to_binlog= $2; lex->no_write_to_binlog= $2;
lex->check_opt.init(); lex->check_opt.init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment