1
by brian
clean slate |
1 |
# suite/funcs_1/t/tables.test |
2 |
#
|
|
3 |
# Check the layout of information_schema.tables and the impact of |
|
4 |
# CREATE/ALTER/DROP TABLE/VIEW/SCHEMA ... on it. |
|
5 |
#
|
|
6 |
# Note: |
|
7 |
# This test is not intended |
|
8 |
# - to show information about the all time existing tables |
|
9 |
# within the databases information_schema and mysql |
|
10 |
# - for checking storage engine properties |
|
11 |
# Therefore please do not alter $engine_type and $other_engine_type. |
|
12 |
# Some results of the subtests depend on the storage engines assigned. |
|
13 |
#
|
|
14 |
# Author: |
|
15 |
# 2008-01-23 mleich WL#4203 Reorganize and fix the data dictionary tests of |
|
16 |
# testsuite funcs_1 |
|
17 |
# Create this script based on older scripts and new code. |
|
18 |
#
|
|
19 |
||
20 |
# --source suite/funcs_1/datadict/datadict.pre |
|
21 |
||
22 |
let $engine_type = MEMORY; |
|
23 |
let $other_engine_type = MyISAM; |
|
24 |
||
25 |
let $is_table = TABLES; |
|
26 |
||
27 |
# The table INFORMATION_SCHEMA.TABLES must exist |
|
28 |
eval SHOW TABLES FROM information_schema LIKE '$is_table'; |
|
29 |
||
30 |
--echo #######################################################################
|
|
31 |
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
|
|
32 |
--echo #######################################################################
|
|
33 |
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT |
|
34 |
# statement, just as if it were an ordinary user-defined table. |
|
35 |
#
|
|
36 |
--source suite/funcs_1/datadict/is_table_query.inc
|
|
37 |
||
38 |
||
39 |
--echo #########################################################################
|
|
40 |
--echo # Testcase 3.2.12.1: INFORMATION_SCHEMA.TABLES layout
|
|
41 |
--echo #########################################################################
|
|
42 |
# Ensure that the INFORMATION_SCHEMA.TABLES table has the following columns, |
|
43 |
# in the following order: |
|
44 |
#
|
|
45 |
# TABLE_CATALOG (always shows NULL), |
|
46 |
# TABLE_SCHEMA (shows the name of the database, or schema, in which an |
|
47 |
# accessible table resides), |
|
48 |
# TABLE_NAME (shows the name of a table which the current user may access), |
|
49 |
# TABLE_TYPE (shows whether the table is a BASE TABLE, a TEMPORARY table, |
|
50 |
# or a VIEW), |
|
51 |
# ENGINE (shows the storage engine used for the table), |
|
52 |
# VERSION (shows the version number of the table's .frm file), |
|
53 |
# ROW_FORMAT (shows the table's row storage format; either FIXED, DYNAMIC |
|
54 |
# or COMPRESSED), |
|
55 |
# TABLE_ROWS (shows the number of rows in the table), |
|
56 |
# AVG_ROW_LENGTH (shows the average length of the table's rows), |
|
57 |
# DATA_LENGTH (shows the length of the table's data file), |
|
58 |
# MAX_DATA_LENGTH (shows the maximum length of the table's data file), |
|
59 |
# INDEX_LENGTH (shows the length of the index file associated with the table),
|
|
60 |
# DATA_FREE (shows the number of allocated, unused bytes),
|
|
61 |
# AUTO_INCREMENT (shows the next AUTO_INCREMENT value, where applicable),
|
|
62 |
# CREATE_TIME (shows the timestamp of the time the table was created),
|
|
63 |
# UPDATE_TIME (shows the timestamp of the time the table's data file was |
|
64 |
# last updated), |
|
65 |
# CHECK_TIME (shows the timestamp of the time the table was last checked), |
|
66 |
# TABLE_COLLATION (shows the table's default collation), |
|
67 |
# CHECKSUM (shows the live checksum value for the table, if any; otherwise NULL),
|
|
68 |
# CREATE_OPTIONS (shows any additional options used in the table's definition; |
|
69 |
# otherwise NULL), |
|
70 |
# TABLE_COMMENT (shows the comment added to the table's definition; |
|
71 |
# otherwise NULL).
|
|
72 |
#
|
|
73 |
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
|
74 |
eval DESCRIBE information_schema.$is_table;
|
|
75 |
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
|
76 |
eval SHOW CREATE TABLE information_schema.$is_table;
|
|
77 |
--source suite/funcs_1/datadict/datadict_bug_12777.inc
|
|
78 |
eval SHOW COLUMNS FROM information_schema.$is_table;
|
|
79 |
||
80 |
# Note: Retrieval of information within information_schema.columns about
|
|
81 |
# information_schema.tables is in is_columns_is.test.
|
|
82 |
||
83 |
# Show that TABLE_CATALOG is always NULL.
|
|
84 |
SELECT table_catalog, table_schema, table_name
|
|
85 |
FROM information_schema.tables WHERE table_catalog IS NOT NULL;
|
|
86 |
||
87 |
||
88 |
--echo ################################################################################
|
|
89 |
--echo # Testcase 3.2.12.2 + 3.2.12.3: INFORMATION_SCHEMA.TABLES accessible information
|
|
90 |
--echo ################################################################################
|
|
91 |
# 3.2.12.2: Ensure that the table shows the relevant information on every base table
|
|
92 |
# and view on which the current user or PUBLIC has privileges.
|
|
93 |
# 3.2.12.3: Ensure that the table does not show any information on any tables
|
|
94 |
# on which the current user and public have no privileges.
|
|
95 |
#
|
|
96 |
# Note: Check of content within information_schema.tables about tables within
|
|
97 |
# database is in
|
|
98 |
# mysql is_tables_mysql.test
|
|
99 |
# information_schema is_tables_is.test
|
|
100 |
# test% is_tables_<engine>.test
|
|
101 |
#
|
|
102 |
--disable_warnings
|
|
103 |
DROP DATABASE IF EXISTS db_datadict;
|
|
104 |
--enable_warnings
|
|
105 |
CREATE DATABASE db_datadict;
|
|
106 |
||
107 |
--error 0,ER_CANNOT_USER
|
|
108 |
DROP USER 'testuser1'@'localhost'; |
|
109 |
CREATE USER 'testuser1'@'localhost'; |
|
110 |
GRANT CREATE, CREATE VIEW, INSERT, SELECT ON db_datadict.*
|
|
111 |
TO 'testuser1'@'localhost' WITH GRANT OPTION; |
|
112 |
--error 0,ER_CANNOT_USER
|
|
113 |
DROP USER 'testuser2'@'localhost'; |
|
114 |
CREATE USER 'testuser2'@'localhost'; |
|
115 |
--error 0,ER_CANNOT_USER
|
|
116 |
DROP USER 'testuser3'@'localhost'; |
|
117 |
CREATE USER 'testuser3'@'localhost'; |
|
118 |
||
119 |
--replace_result $engine_type <engine_type>
|
|
120 |
eval
|
|
121 |
CREATE TABLE db_datadict.tb1 (f1 INT, f2 INT, f3 INT)
|
|
122 |
ENGINE = $engine_type;
|
|
123 |
||
124 |
GRANT SELECT ON db_datadict.tb1 TO 'testuser1'@'localhost'; |
|
125 |
GRANT ALL ON db_datadict.tb1 TO 'testuser2'@'localhost' WITH GRANT OPTION; |
|
126 |
||
127 |
let $my_select = SELECT * FROM information_schema.tables
|
|
128 |
WHERE table_schema = 'db_datadict' ORDER BY table_name; |
|
129 |
let $my_show = SHOW TABLES FROM db_datadict;
|
|
130 |
||
131 |
--echo # Establish connection testuser1 (user=testuser1)
|
|
132 |
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
133 |
connect (testuser1, localhost, testuser1, , db_datadict);
|
|
134 |
# tb2 is not granted to anyone
|
|
135 |
--replace_result $engine_type <engine_type>
|
|
136 |
eval
|
|
137 |
CREATE TABLE tb2 (f1 DECIMAL)
|
|
138 |
ENGINE = $engine_type;
|
|
139 |
--replace_result $engine_type <engine_type>
|
|
140 |
eval
|
|
141 |
CREATE TABLE tb3 (f1 VARCHAR(200))
|
|
142 |
ENGINE = $engine_type;
|
|
143 |
GRANT SELECT ON db_datadict.tb3 to 'testuser3'@'localhost'; |
|
144 |
GRANT INSERT ON db_datadict.tb3 to 'testuser2'@'localhost'; |
|
145 |
CREATE VIEW v3 AS SELECT * FROM tb3;
|
|
146 |
GRANT SELECT ON db_datadict.v3 to 'testuser3'@'localhost'; |
|
147 |
||
148 |
if ($have_bug_32285)
|
|
149 |
{
|
|
150 |
--disable_ps_protocol
|
|
151 |
}
|
|
152 |
# We do not want to check here values affected by
|
|
153 |
# - the storage engine used
|
|
154 |
# - Operating system / Filesystem
|
|
155 |
# - start time of test
|
|
156 |
# 1 TABLE_CATALOG
|
|
157 |
# 2 TABLE_SCHEMA
|
|
158 |
# 3 TABLE_NAME
|
|
159 |
# 4 TABLE_TYPE
|
|
160 |
# 5 ENGINE affected by storage engine used
|
|
161 |
# 6 VERSION
|
|
162 |
# 7 ROW_FORMAT affected by storage engine used
|
|
163 |
# 8 TABLE_ROWS
|
|
164 |
# 9 AVG_ROW_LENGTH affected by storage engine used
|
|
165 |
# 10 DATA_LENGTH affected by storage engine used and maybe OS
|
|
166 |
# 11 MAX_DATA_LENGTH affected by storage engine used and maybe OS
|
|
167 |
# 12 INDEX_LENGTH affected by storage engine used and maybe OS
|
|
168 |
# 13 DATA_FREE affected by storage engine used and maybe OS
|
|
169 |
# 14 AUTO_INCREMENT
|
|
170 |
# 15 CREATE_TIME depends roughly on start time of test (*)
|
|
171 |
# 16 UPDATE_TIME depends roughly on start time of test (*)
|
|
172 |
# 17 CHECK_TIME depends roughly on start time of test and storage engine (*)
|
|
173 |
# 18 TABLE_COLLATION
|
|
174 |
# 19 CHECKSUM affected by storage engine used
|
|
175 |
# 20 CREATE_OPTIONS
|
|
176 |
# 21 TABLE_COMMENT affected by some storage engines
|
|
177 |
# (*) In case of view or temporary table NULL.
|
|
178 |
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
|
179 |
eval $my_select;
|
|
180 |
--enable_ps_protocol
|
|
181 |
--sorted_result
|
|
182 |
eval $my_show;
|
|
183 |
||
184 |
--echo # Establish connection testuser2 (user=testuser2)
|
|
185 |
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
186 |
connect (testuser2, localhost, testuser2, , db_datadict);
|
|
187 |
if ($have_bug_32285)
|
|
188 |
{
|
|
189 |
--disable_ps_protocol
|
|
190 |
}
|
|
191 |
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
|
192 |
eval $my_select;
|
|
193 |
--enable_ps_protocol
|
|
194 |
--sorted_result
|
|
195 |
eval $my_show;
|
|
196 |
||
197 |
--echo # Establish connection testuser3 (user=testuser3)
|
|
198 |
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK
|
|
199 |
connect (testuser3, localhost, testuser3, , db_datadict);
|
|
200 |
if ($have_bug_32285)
|
|
201 |
{
|
|
202 |
--disable_ps_protocol
|
|
203 |
}
|
|
204 |
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
|
205 |
eval $my_select;
|
|
206 |
--enable_ps_protocol
|
|
207 |
--sorted_result
|
|
208 |
eval $my_show;
|
|
209 |
||
210 |
--echo # Switch to connection default (user=root)
|
|
211 |
connection default;
|
|
212 |
# we see only 'public' tables |
|
213 |
if ($have_bug_32285)
|
|
214 |
{
|
|
215 |
--disable_ps_protocol
|
|
216 |
}
|
|
217 |
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
|
218 |
eval $my_select;
|
|
219 |
--enable_ps_protocol
|
|
220 |
--sorted_result
|
|
221 |
eval $my_show;
|
|
222 |
||
223 |
# Cleanup
|
|
224 |
--echo # Close connection testuser1, testuser2, testuser3
|
|
225 |
disconnect testuser1;
|
|
226 |
disconnect testuser2;
|
|
227 |
disconnect testuser3;
|
|
228 |
DROP USER 'testuser1'@'localhost'; |
|
229 |
DROP USER 'testuser2'@'localhost'; |
|
230 |
DROP USER 'testuser3'@'localhost'; |
|
231 |
DROP DATABASE db_datadict;
|
|
232 |
||
233 |
||
234 |
--echo #########################################################################
|
|
235 |
--echo # 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.TABLES modifications
|
|
236 |
--echo #########################################################################
|
|
237 |
# 3.2.1.13: Ensure that the creation of any new database object (e.g. table or
|
|
238 |
# column) automatically inserts all relevant information on that
|
|
239 |
# object into every appropriate INFORMATION_SCHEMA table.
|
|
240 |
# 3.2.1.14: Ensure that the alteration of any existing database object
|
|
241 |
# automatically updates all relevant information on that object in
|
|
242 |
# every appropriate INFORMATION_SCHEMA table.
|
|
243 |
# 3.2.1.15: Ensure that the dropping of any existing database object
|
|
244 |
# automatically deletes all relevant information on that object from
|
|
245 |
# every appropriate INFORMATION_SCHEMA table.
|
|
246 |
#
|
|
247 |
--disable_warnings
|
|
248 |
DROP TABLE IF EXISTS test.t1_my_table;
|
|
249 |
DROP DATABASE IF EXISTS db_datadict;
|
|
250 |
--enable_warnings
|
|
251 |
CREATE DATABASE db_datadict;
|
|
252 |
||
253 |
SELECT table_name FROM information_schema.tables
|
|
254 |
WHERE table_name LIKE 't1_my_table%'; |
|
255 |
--replace_result $engine_type <engine_type>
|
|
256 |
eval
|
|
257 |
CREATE TABLE test.t1_my_table (f1 BIGINT)
|
|
258 |
DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
|
|
259 |
COMMENT = 'Initial Comment' ENGINE = $engine_type; |
|
260 |
# Settings used in CREATE TABLE must be visible in information_schema.tables.
|
|
261 |
--vertical_results
|
|
262 |
--replace_column 5 "#ENG#" 7 "#RF#" 9 "#ARL#" 10 "#DL#" 11 "#MDL#" 12 "#IL#" 13 "#DF#" 15 "#CRT" 16 "#UT#" 17 "#CT#" 19 "#CS#"
|
|
263 |
SELECT * FROM information_schema.tables
|
|
264 |
WHERE table_name = 't1_my_table'; |
|
265 |
--horizontal_results
|
|
266 |
#
|
|
267 |
# Check modification of TABLE_NAME
|
|
268 |
SELECT table_name FROM information_schema.tables
|
|
269 |
WHERE table_name LIKE 't1_my_table%'; |
|
270 |
RENAME TABLE test.t1_my_table TO test.t1_my_tablex;
|
|
271 |
SELECT table_name FROM information_schema.tables
|
|
272 |
WHERE table_name LIKE 't1_my_table%'; |
|
273 |
#
|
|
274 |
# Check modification of TABLE_SCHEMA
|
|
275 |
SELECT table_schema,table_name FROM information_schema.tables
|
|
276 |
WHERE table_name = 't1_my_tablex'; |
|
277 |
RENAME TABLE test.t1_my_tablex TO db_datadict.t1_my_tablex;
|
|
278 |
SELECT table_schema,table_name FROM information_schema.tables
|
|
279 |
WHERE table_name = 't1_my_tablex'; |
|
280 |
#
|
|
281 |
# Check modification of ENGINE
|
|
282 |
--replace_result $engine_type <engine_type>
|
|
283 |
SELECT table_name, engine FROM information_schema.tables
|
|
284 |
WHERE table_name = 't1_my_tablex'; |
|
285 |
--replace_result $other_engine_type <other_engine_type>
|
|
286 |
eval
|
|
287 |
ALTER TABLE db_datadict.t1_my_tablex
|
|
288 |
ENGINE = $other_engine_type;
|
|
289 |
--replace_result $other_engine_type <other_engine_type>
|
|
290 |
SELECT table_name, engine FROM information_schema.tables
|
|
291 |
WHERE table_name = 't1_my_tablex'; |
|
292 |
#
|
|
293 |
# Check modification of TABLE_ROWS
|
|
294 |
SELECT table_name, table_rows FROM information_schema.tables
|
|
295 |
WHERE table_name = 't1_my_tablex'; |
|
296 |
INSERT INTO db_datadict.t1_my_tablex VALUES(1),(2);
|
|
297 |
SELECT table_name, table_rows FROM information_schema.tables
|
|
298 |
WHERE table_name = 't1_my_tablex'; |
|
299 |
#
|
|
300 |
# Check indirect modification of TABLE_COLLATION
|
|
301 |
SELECT table_name, table_collation FROM information_schema.tables
|
|
302 |
WHERE table_name = 't1_my_tablex'; |
|
303 |
ALTER TABLE db_datadict.t1_my_tablex DEFAULT CHARACTER SET utf8;
|
|
304 |
SELECT table_name, table_collation FROM information_schema.tables
|
|
305 |
WHERE table_name = 't1_my_tablex'; |
|
306 |
# Check direct modification of TABLE_COLLATION
|
|
307 |
SELECT table_name, table_collation FROM information_schema.tables
|
|
308 |
WHERE table_name = 't1_my_tablex'; |
|
309 |
ALTER TABLE db_datadict.t1_my_tablex
|
|
310 |
DEFAULT CHARACTER SET latin1 COLLATE latin1_german1_ci;
|
|
311 |
SELECT table_name, table_collation FROM information_schema.tables
|
|
312 |
WHERE table_name = 't1_my_tablex'; |
|
313 |
#
|
|
314 |
# Check modification of TABLE_COMMENT
|
|
315 |
SELECT table_name, TABLE_COMMENT FROM information_schema.tables
|
|
316 |
WHERE table_name = 't1_my_tablex'; |
|
317 |
ALTER TABLE db_datadict.t1_my_tablex COMMENT 'Changed Comment'; |
|
318 |
SELECT table_name, TABLE_COMMENT FROM information_schema.tables
|
|
319 |
WHERE table_name = 't1_my_tablex'; |
|
320 |
#
|
|
321 |
# Check modification of AUTO_INCREMENT
|
|
322 |
SELECT table_name, AUTO_INCREMENT FROM information_schema.tables
|
|
323 |
WHERE table_name = 't1_my_tablex'; |
|
324 |
ALTER TABLE db_datadict.t1_my_tablex
|
|
325 |
ADD f2 BIGINT AUTO_INCREMENT, ADD PRIMARY KEY (f2);
|
|
326 |
SELECT table_name, AUTO_INCREMENT FROM information_schema.tables
|
|
327 |
WHERE table_name = 't1_my_tablex'; |
|
328 |
#
|
|
329 |
# Check modification of ROW_FORMAT
|
|
330 |
SELECT table_name, ROW_FORMAT FROM information_schema.tables
|
|
331 |
WHERE table_name = 't1_my_tablex'; |
|
332 |
ALTER TABLE db_datadict.t1_my_tablex ROW_FORMAT = dynamic;
|
|
333 |
SELECT table_name, ROW_FORMAT FROM information_schema.tables
|
|
334 |
WHERE table_name = 't1_my_tablex'; |
|
335 |
#
|
|
336 |
# Check "growth" of UPDATE_TIME and modification of CHECKSUM
|
|
337 |
SELECT table_name, checksum FROM information_schema.tables
|
|
338 |
WHERE table_name = 't1_my_tablex'; |
|
339 |
ALTER TABLE db_datadict.t1_my_tablex CHECKSUM = 1;
|
|
340 |
SELECT table_name, checksum IS NOT NULL FROM information_schema.tables
|
|
341 |
WHERE table_name = 't1_my_tablex'; |
|
342 |
SELECT UPDATE_TIME, checksum INTO @UPDATE_TIME, @checksum
|
|
343 |
FROM information_schema.tables
|
|
344 |
WHERE table_name = 't1_my_tablex'; |
|
345 |
# Enforce a time difference bigger than the smallest unit (1 second).
|
|
346 |
--real_sleep 1.1
|
|
347 |
INSERT INTO db_datadict.t1_my_tablex SET f1 = 3;
|
|
348 |
SELECT UPDATE_TIME > @UPDATE_TIME
|
|
349 |
AS "Is current UPDATE_TIME bigger than before last INSERT?"
|
|
350 |
FROM information_schema.tables
|
|
351 |
WHERE table_name = 't1_my_tablex'; |
|
352 |
SELECT checksum <> @checksum
|
|
353 |
AS "Is current CHECKSUM different than before last INSERT?"
|
|
354 |
FROM information_schema.tables
|
|
355 |
WHERE table_name = 't1_my_tablex'; |
|
356 |
#
|
|
357 |
# Information is used later
|
|
358 |
SELECT CREATE_TIME INTO @CREATE_TIME FROM information_schema.tables
|
|
359 |
WHERE table_name = 't1_my_tablex'; |
|
360 |
#
|
|
361 |
# Check impact of DROP TABLE
|
|
362 |
SELECT table_name FROM information_schema.tables
|
|
363 |
WHERE table_name LIKE 't1_my_table%'; |
|
364 |
DROP TABLE db_datadict.t1_my_tablex;
|
|
365 |
SELECT table_name FROM information_schema.tables
|
|
366 |
WHERE table_name LIKE 't1_my_table%'; |
|
367 |
#
|
|
368 |
# Check "growth" of CREATE_TIME
|
|
369 |
--replace_result $other_engine_type <other_engine_type>
|
|
370 |
eval
|
|
371 |
CREATE TABLE test.t1_my_tablex (f1 BIGINT)
|
|
372 |
ENGINE = $other_engine_type;
|
|
373 |
SELECT CREATE_TIME > @CREATE_TIME
|
|
374 |
AS "Is current CREATE_TIME bigger than for the old dropped table?"
|
|
375 |
FROM information_schema.tables
|
|
376 |
WHERE table_name = 't1_my_tablex'; |
|
377 |
DROP TABLE test.t1_my_tablex;
|
|
378 |
#
|
|
379 |
# Check a VIEW
|
|
380 |
CREATE VIEW test.t1_my_tablex AS SELECT 1;
|
|
381 |
--vertical_results
|
|
382 |
SELECT * FROM information_schema.tables
|
|
383 |
WHERE table_name = 't1_my_tablex'; |
|
384 |
--horizontal_results
|
|
385 |
DROP VIEW test.t1_my_tablex;
|
|
386 |
SELECT table_name FROM information_schema.tables
|
|
387 |
WHERE table_name = 't1_my_tablex'; |
|
388 |
#
|
|
389 |
# Check a temporary table
|
|
390 |
--replace_result $other_engine_type <other_engine_type>
|
|
391 |
eval
|
|
392 |
CREATE TEMPORARY TABLE test.t1_my_tablex
|
|
393 |
ENGINE = $other_engine_type
|
|
394 |
AS SELECT 1;
|
|
395 |
--vertical_results
|
|
396 |
SELECT table_name, table_type FROM information_schema.tables
|
|
397 |
WHERE table_name = 't1_my_tablex'; |
|
398 |
--horizontal_results
|
|
399 |
DROP TEMPORARY TABLE test.t1_my_tablex;
|
|
400 |
#
|
|
401 |
# Check impact of DROP SCHEMA
|
|
402 |
--replace_result $engine_type <engine_type>
|
|
403 |
eval
|
|
404 |
CREATE TABLE db_datadict.t1_my_tablex
|
|
405 |
ENGINE = $engine_type AS
|
|
406 |
SELECT 1;
|
|
407 |
SELECT table_name FROM information_schema.tables
|
|
408 |
WHERE table_name = 't1_my_tablex'; |
|
409 |
DROP DATABASE db_datadict;
|
|
410 |
SELECT table_name FROM information_schema.tables
|
|
411 |
WHERE table_name = 't1_my_tablex'; |
|
412 |
||
413 |
||
414 |
--echo ########################################################################
|
|
415 |
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
|
|
416 |
--echo # DDL on INFORMATION_SCHEMA tables are not supported
|
|
417 |
--echo ########################################################################
|
|
418 |
# 3.2.1.3: Ensure that no user may execute an INSERT statement on any
|
|
419 |
# INFORMATION_SCHEMA table.
|
|
420 |
# 3.2.1.4: Ensure that no user may execute an UPDATE statement on any
|
|
421 |
# INFORMATION_SCHEMA table.
|
|
422 |
# 3.2.1.5: Ensure that no user may execute a DELETE statement on any
|
|
423 |
# INFORMATION_SCHEMA table.
|
|
424 |
# 3.2.1.8: Ensure that no user may create an index on an
|
|
425 |
# INFORMATION_SCHEMA table.
|
|
426 |
# 3.2.1.9: Ensure that no user may alter the definition of an
|
|
427 |
# INFORMATION_SCHEMA table.
|
|
428 |
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
|
|
429 |
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
|
|
430 |
# other database.
|
|
431 |
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
|
|
432 |
# in an INFORMATION_SCHEMA table.
|
|
433 |
#
|
|
434 |
--disable_warnings
|
|
435 |
DROP DATABASE IF EXISTS db_datadict;
|
|
436 |
--enable_warnings
|
|
437 |
CREATE DATABASE db_datadict;
|
|
438 |
--replace_result $engine_type <engine_type>
|
|
439 |
eval
|
|
440 |
CREATE TABLE db_datadict.t1 (f1 BIGINT)
|
|
441 |
ENGINE = $engine_type;
|
|
442 |
||
443 |
--error ER_DBACCESS_DENIED_ERROR
|
|
444 |
INSERT INTO information_schema.tables
|
|
445 |
SELECT * FROM information_schema.tables;
|
|
446 |
||
447 |
--error ER_DBACCESS_DENIED_ERROR
|
|
448 |
UPDATE information_schema.tables SET table_schema = 'test' |
|
449 |
WHERE table_name = 't1'; |
|
450 |
||
451 |
--error ER_DBACCESS_DENIED_ERROR
|
|
452 |
DELETE FROM information_schema.tables WHERE table_name = 't1'; |
|
453 |
--error ER_DBACCESS_DENIED_ERROR
|
|
454 |
TRUNCATE information_schema.tables; |
|
455 |
||
456 |
--error ER_DBACCESS_DENIED_ERROR
|
|
457 |
CREATE INDEX my_idx_on_tables ON information_schema.tables(table_schema); |
|
458 |
||
459 |
--error ER_DBACCESS_DENIED_ERROR
|
|
460 |
ALTER TABLE information_schema.tables DROP PRIMARY KEY; |
|
461 |
--error ER_DBACCESS_DENIED_ERROR
|
|
462 |
ALTER TABLE information_schema.tables ADD f1 INT; |
|
463 |
||
464 |
--error ER_DBACCESS_DENIED_ERROR
|
|
465 |
DROP TABLE information_schema.tables; |
|
466 |
||
467 |
--error ER_DBACCESS_DENIED_ERROR
|
|
468 |
ALTER TABLE information_schema.tables RENAME db_datadict.tables; |
|
469 |
--error ER_DBACCESS_DENIED_ERROR
|
|
470 |
ALTER TABLE information_schema.tables RENAME information_schema.xtables; |
|
471 |
||
472 |
# Cleanup |
|
473 |
DROP DATABASE db_datadict; |
|
474 |