You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.9 KiB

  1. # Embedded server doesn't support external clients
  2. --source include/not_embedded.inc
  3. # Don't run this test if $MYSQL_FIX_PRIVILEGE_TABLES isn't set
  4. # to the location of mysql_fix_privilege_tables.sql
  5. if (`SELECT LENGTH("$MYSQL_FIX_PRIVILEGE_TABLES") <= 0`)
  6. {
  7. skip Test need MYSQL_FIX_PRIVILEGE_TABLES;
  8. }
  9. #
  10. # This is the test for mysql_fix_privilege_tables
  11. # It checks that a system tables from mysql 4.1.23
  12. # can be upgraded to current system table format
  13. #
  14. # Note: If this test fails, don't be confused about the errors reported
  15. # by mysql-test-run This shows warnings generated by
  16. # mysql_fix_system_tables which should be ignored.
  17. # Instead, concentrate on the errors in r/system_mysql_db.reject
  18. --disable_warnings
  19. drop table if exists t1,t1aa,t2aa;
  20. --enable_warnings
  21. #
  22. # Bug #20589 Missing some table level privileges after upgrade
  23. #
  24. # Add some grants that should survive the "upgrade"
  25. --disable_warnings
  26. DROP DATABASE IF EXISTS testdb;
  27. --enable_warnings
  28. CREATE DATABASE testdb;
  29. CREATE TABLE testdb.t1 (
  30. c1 INT,
  31. c3 INT NOT NULL AUTO_INCREMENT PRIMARY KEY);
  32. CREATE VIEW testdb.v1 AS
  33. SELECT * FROM testdb.t1;
  34. GRANT CREATE VIEW, SHOW VIEW ON testdb.v1 TO 'show_view_tbl'@'localhost';
  35. SHOW GRANTS FOR 'show_view_tbl'@'localhost';
  36. echo;
  37. # Some extra GRANTS for more complete test
  38. GRANT SELECT(c1) on testdb.v1 to 'select_only_c1'@localhost;
  39. SHOW GRANTS FOR 'select_only_c1'@'localhost';
  40. echo;
  41. -- disable_result_log
  42. -- disable_query_log
  43. # Run the mysql_fix_privilege_tables.sql using "mysql --force"
  44. --exec $MYSQL --force mysql < $MYSQL_FIX_PRIVILEGE_TABLES > $MYSQLTEST_VARDIR/log/fix_priv_tables.log 2>&1
  45. -- enable_query_log
  46. -- enable_result_log
  47. echo "after fix privs";
  48. SHOW GRANTS FOR 'show_view_tbl'@'localhost';
  49. echo;
  50. SHOW GRANTS FOR 'select_only_c1'@'localhost';
  51. echo;
  52. DROP USER 'show_view_tbl'@'localhost';
  53. DROP USER 'select_only_c1'@'localhost';
  54. DROP VIEW testdb.v1;
  55. DROP TABLE testdb.t1;
  56. DROP DATABASE testdb;
  57. # End of 4.1 tests