MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
datadict_priv.inc
1 ############## suite/funcs_1/datadict/datadict_priv.inc ################
2 # #
3 # DDL and DML operations on information_schema tables #
4 # #
5 # Creation: #
6 # 2007-08 hhunger Implement this test as part of #
7 # WL#3982 Test information_schema.processlist #
8 # #
9 # Last update: #
10 # 2007-08-14 mleich Some cleanup #
11 # #
12 ########################################################################
13 
14 # These variables have to be set before sourcing this file.
15 #
16 # information_schema table to be tested
17 # let $table= processlist;
18 #
19 # columns of the information_schema table e.g. to use in a select.
20 # let $columns= ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO;
21 #
22 # Where clause for an update.
23 # let $update_where= WHERE id=1 ;
24 #
25 # Column to be used in the SET of an update.
26 # let $set_column= user='any_user' ;
27 #
28 # Where clause of a delete.
29 # let $delete_where= WHERE id=1 ;
30 #
31 # Column to be dropped.
32 # let $drop_column= user;
33 #
34 # Column to be indexed
35 # let $index_col= user;
36 
37 
38 # data access
39 
40 eval CREATE TEMPORARY TABLE test.t_$table AS SELECT * FROM $table;
41 
42 eval UPDATE test.t_$table SET user='horst' $update_where ;
43 
44 --error ER_DBACCESS_DENIED_ERROR
45 eval INSERT INTO $table SELECT * FROM test.t_$table;
46 
47 # bug#30208: CREATE TABLE ...LIKE does not accept dbname.tablename:unknown database
48 eval DROP TABLE test.t_$table;
49 
50 --error ER_VIEW_NONUPD_CHECK
51 eval CREATE VIEW test.v_$table ($columns) AS SELECT * FROM $table WITH CHECK OPTION;
52 
53 eval CREATE VIEW test.v_$table ($columns) AS SELECT * FROM $table;
54 
55 --error ER_NON_UPDATABLE_TABLE
56 eval UPDATE test.v_$TABLE SET TIME=NOW() WHERE id = 1;
57 
58 eval DROP VIEW test.v_$table;
59 
60 --error ER_DBACCESS_DENIED_ERROR
61 eval UPDATE $table SET $set_column $update_where;
62 
63 --error ER_DBACCESS_DENIED_ERROR
64 eval DELETE FROM $table $delete_where;
65 
66 # change privileges
67 
68 --error ER_DBACCESS_DENIED_ERROR
69 eval REVOKE ALL ON $table FROM current_user;
70 
71 --error ER_DBACCESS_DENIED_ERROR
72 eval GRANT INSERT,UPDATE ON $table TO current_user;
73 
74 SHOW GRANTS;
75 
76 #----------------------------------------------------------------------
77 # table access
78 
79 --error ER_DBACCESS_DENIED_ERROR
80 eval CREATE INDEX i_$table ON $table ($index_col);
81 
82 --error ER_DBACCESS_DENIED_ERROR
83 eval DROP TABLE $table;
84 
85 --error ER_DBACCESS_DENIED_ERROR
86 eval ALTER TABLE $table DROP COLUMN $drop_column;
87 
88 --error ER_DBACCESS_DENIED_ERROR
89 eval ALTER TABLE $table ADD COLUMN (my_column INT);
90 
91 --error ER_DBACCESS_DENIED_ERROR
92 eval RENAME TABLE $table TO new_$table;
93 
94 --error ER_DBACCESS_DENIED_ERROR
95 eval RENAME TABLE $table TO files;
96 
97 --error ER_DBACCESS_DENIED_ERROR
98 eval CREATE TABLE new_$table AS SELECT * FROM $table;
99 
100 #----------------------------------------------------------------------
101 # database access
102 
103 --error ER_DBACCESS_DENIED_ERROR
104 DROP DATABASE information_schema;
105 
106 --error ER_PARSE_ERROR
107 RENAME DATABASE information_schema TO info_schema;
108 
109 --error ER_DBACCESS_DENIED_ERROR
110 ALTER DATABASE information_schema UPGRADE DATA DIRECTORY NAME;