Commit 719089a8 authored by serg@serg.mylan's avatar serg@serg.mylan

better error for optimize/repair/etc a view

parent 9c0a8bbd
......@@ -4180,55 +4180,55 @@ 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'
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 note Unknown table 'test.v1'
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 note Unknown table 'test.v1'
test.v1 analyze error 'test.v1' is not BASE TABLE
Warnings:
Error 1146 Table 'test.t3' doesn't exist
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 note Unknown table 'test.v1'
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 note Unknown table 'test.v1'
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 note Unknown table 'test.v1'
test.v1 analyze error 'test.v1' is not BASE TABLE
Warnings:
Error 1146 Table 'test.t3' doesn't exist
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 note Unknown table 'test.v1'
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 note Unknown table 'test.v1'
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 note Unknown table 'test.v1'
test.v1 analyze error 'test.v1' is not BASE TABLE
Warnings:
Error 1146 Table 'test.t3' doesn't exist
Error 1347 'test.v1' is not BASE TABLE
drop procedure bug13012|
drop view v1;
select * from t1|
......
......@@ -2383,20 +2383,25 @@ CREATE TABLE t1(id INT);
CREATE VIEW v1 AS SELECT id FROM t1;
OPTIMIZE TABLE v1;
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;
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;
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;
OPTIMIZE TABLE v1;
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 1146 Table 'test.t1' doesn't exist
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
Error 1347 'test.v1' is not BASE TABLE
DROP VIEW v1;
create definer = current_user() sql security invoker view v1 as select 1;
show create view v1;
......
......@@ -2225,18 +2225,11 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
lex->query_tables_own_last= 0;
thd->no_warnings_for_error= no_warnings_for_error;
if (view_operator_func == NULL)
simple_open_n_lock_tables(thd, table);
else
open_and_lock_tables(thd, table);
table->required_type=FRMTYPE_TABLE;
open_and_lock_tables(thd, table);
thd->no_warnings_for_error= 0;
table->next_global= save_next_global;
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;
if (prepare_func)
......
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