mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#5507: TRUNCATE does not work with views.
Support of views wasn't implemented for the TRUNCATE statement. Now TRUNCATE on views has the same semantics as DELETE FROM view: mysql_truncate() checks whether the table is a view and falls back to delete if so. In order to initialize properly the LEX::updatable for a view st_lex::can_use_merged() now allows usage of merged views for the TRUNCATE statement. mysql-test/r/truncate.result: Added a test case for the Bug#5507: TRUNCATE does not work with views. mysql-test/t/truncate.test: Added a test case for the Bug#5507: TRUNCATE does not work with views. sql/sql_lex.cc: Bug#5507: TRUNCATE does not work with views. can_use_merged() was denying of usage of merged views for a TRUNCATE statement. This results in improper initialization of view LEX::updatable. Fixed. sql/sql_delete.cc: Bug#5507: TRUNCATE does not work with views. 1.mysql_truncate() was lacking of check whether the table is view. Added. 2.mysql_truncate() calls mysql_delete(), but mysql_delete() always reports errors as "DELETE" errors. Fixed. mysql-test/t/view.test: Updated test case for Bug#14540: OPTIMIZE, ANALYZE, REPAIR applied to not a view. mysql-test/r/view.result: Updated test case for Bug#14540: OPTIMIZE, ANALYZE, REPAIR applied to not a view.
This commit is contained in:
@ -2395,6 +2395,16 @@ Table Op Msg_type Msg_text
|
||||
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 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 error 'test.v1' is not BASE TABLE
|
||||
Warnings:
|
||||
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;
|
||||
|
Reference in New Issue
Block a user