• unknown's avatar
    Bug#5507: TRUNCATE does not work with views. · 0b54001b
    unknown authored
    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.
    0b54001b
sql_delete.cc 26.9 KB