mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +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:
@ -1834,6 +1834,7 @@ bool st_lex::can_use_merged()
|
||||
case SQLCOM_UPDATE_MULTI:
|
||||
case SQLCOM_DELETE:
|
||||
case SQLCOM_DELETE_MULTI:
|
||||
case SQLCOM_TRUNCATE:
|
||||
case SQLCOM_INSERT:
|
||||
case SQLCOM_INSERT_SELECT:
|
||||
case SQLCOM_REPLACE:
|
||||
|
Reference in New Issue
Block a user