~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/t/fix_priv_tables.test

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

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