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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
SHOW DATABASES LIKE 'information_schema';
Database (information_schema)
information_schema
#######################################################################
# Testcase 3.2.1.20: USE INFORMATION_SCHEMA is supported
#######################################################################
# Switch to connection default
USE test;
SELECT DATABASE();
DATABASE()
test
USE information_schema;
SELECT DATABASE();
DATABASE()
information_schema
DROP   USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
# Establish connection testuser1 (user=testuser1)
SELECT DATABASE();
DATABASE()
test
USE information_schema;
SELECT DATABASE();
DATABASE()
information_schema
# Switch to connection default and close connection testuser1
DROP   USER 'testuser1'@'localhost';
#######################################################################
# Testcase TBD1: The INFORMATION_SCHEMA cannot be dropped.
#######################################################################
DROP DATABASE information_schema;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
#######################################################################
# Testcase TBD2: There cannot be a second database INFORMATION_SCHEMA.
#######################################################################
CREATE DATABASE information_schema;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
##################################################################################
# Testcase 3.2.1.6+3.2.1.7: No user may create an INFORMATION_SCHEMA table or view
##################################################################################
# Switch to connection default (user=root)
USE information_schema;
CREATE TABLE schemata                              ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE tables                                ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE columns                               ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE character_sets                        ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE collations                            ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE collation_character_set_applicability ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE routines                              ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE statistics                            ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE views                                 ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE user_privileges                       ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE schema_privileges                     ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE table_privileges                      ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE column_privileges                     ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE table_constraints                     ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE key_column_usage                      ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE triggers                              ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
ERROR 42S02: Unknown table 't1' in information_schema
CREATE VIEW tables AS SELECT 'garbage';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW tables AS SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW v1 AS SELECT 'garbage';
ERROR 42S02: Unknown table 'v1' in information_schema
USE test;
CREATE TABLE information_schema. schemata                              ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. tables                                ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. columns                               ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. character_sets                        ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. collations                            ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. collation_character_set_applicability ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. routines                              ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. statistics                            ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. views                                 ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. user_privileges                       ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. schema_privileges                     ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. table_privileges                      ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. column_privileges                     ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. table_constraints                     ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. key_column_usage                      ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. triggers                              ( c1 INT );
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT);
ERROR 42S02: Unknown table 't1' in information_schema
CREATE VIEW information_schema.tables AS SELECT 'garbage';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.tables AS
SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.v1 AS SELECT 'garbage';
ERROR 42S02: Unknown table 'v1' in information_schema
DROP   USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
GRANT ALL ON *.* TO testuser1@localhost;
SHOW GRANTS FOR testuser1@localhost;
Grants for testuser1@localhost
GRANT ALL PRIVILEGES ON *.* TO 'testuser1'@'localhost'
# Establish connection testuser1 (user=testuser1)
USE information_schema;
CREATE TABLE schemata                              ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE tables                                ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE columns                               ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE character_sets                        ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE collations                            ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE collation_character_set_applicability ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE routines                              ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE statistics                            ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE views                                 ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE user_privileges                       ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE schema_privileges                     ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE table_privileges                      ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE column_privileges                     ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE table_constraints                     ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE key_column_usage                      ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE triggers                              ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
ERROR 42S02: Unknown table 't1' in information_schema
CREATE VIEW tables AS SELECT 'garbage';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW tables AS SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW v1 AS SELECT 'garbage';
ERROR 42S02: Unknown table 'v1' in information_schema
USE test;
CREATE TABLE information_schema. schemata                              ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. tables                                ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. columns                               ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. character_sets                        ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. collations                            ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. collation_character_set_applicability ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. routines                              ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. statistics                            ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. views                                 ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. user_privileges                       ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. schema_privileges                     ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. table_privileges                      ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. column_privileges                     ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. table_constraints                     ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. key_column_usage                      ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema. triggers                              ( c1 INT );
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE TABLE information_schema.t1 (f1 INT, f2 INT, f3 INT);
ERROR 42S02: Unknown table 't1' in information_schema
CREATE VIEW information_schema.tables AS SELECT 'garbage';
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.tables AS
SELECT * FROM information_schema.tables;
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'information_schema'
CREATE VIEW information_schema.v1 AS SELECT 'garbage';
ERROR 42S02: Unknown table 'v1' in information_schema
# Switch to connection default (user=root) and close connection testuser1
DROP   USER 'testuser1'@'localhost';
###############################################################################
# Testcase 3.2.1.1+3.2.1.2: INFORMATION_SCHEMA tables can be queried via SELECT
###############################################################################
DROP DATABASE IF EXISTS db_datadict;
CREATE DATABASE db_datadict;
CREATE TABLE db_datadict.t1_first (f1 BIGINT UNIQUE, f2 BIGINT)
ENGINE = <some_engine>;
CREATE TABLE db_datadict.t1_second (f1 BIGINT UNIQUE, f2 BIGINT)
ENGINE = <some_engine>;
# Attention: The protocolling of the next result set is disabled.
SELECT * FROM information_schema.tables;
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'db_datadict';
table_name
t1_first
t1_second
SELECT LENGTH(table_name) FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name;
LENGTH(table_name)
8
9
SELECT count(table_name) FROM information_schema.tables
WHERE table_schema LIKE 'db_datadic%';
count(table_name)
2
SELECT CAST((LENGTH(table_schema) + LENGTH(table_name)) AS DECIMAL(15,1))
FROM information_schema.tables
WHERE table_schema = 'db_datadict';
CAST((LENGTH(table_schema) + LENGTH(table_name)) AS DECIMAL(15,1))
19.0
20.0
SELECT table_name FROM information_schema.tables
WHERE table_name IN ('t1_first','t1_second') ORDER BY table_name LIMIT 1;
table_name
t1_first
SELECT table_name FROM information_schema.tables
WHERE table_name IN ('t1_first','t1_second') ORDER BY table_name LIMIT 1,1;
table_name
t1_second
SELECT table_name,table_schema AS my_col FROM information_schema.tables
WHERE table_name = 't1_first' AND table_schema = 'db_datadict';
table_name	my_col
t1_first	db_datadict
SELECT HIGH_PRIORITY table_name AS my_col FROM information_schema.tables
WHERE table_name = 't1_first' OR table_name = 't1_second';
my_col
t1_first
t1_second
SELECT 1 AS my_col FROM information_schema.tables
WHERE table_name = 't1_third';
my_col
SELECT table_name,table_schema INTO @table_name,@table_schema
FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name LIMIT 1;
SELECT @table_name,@table_schema;
@table_name	@table_schema
t1_first	db_datadict
SELECT table_name,table_schema
INTO OUTFILE '<OUTFILE>'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM information_schema.tables
WHERE table_schema = 'db_datadict' ORDER BY table_name;
"t1_first","db_datadict"
"t1_second","db_datadict"
SELECT table_name FROM information_schema.tables
WHERE table_name = 't1_first'
UNION ALL
SELECT table_name FROM information_schema.tables
WHERE table_name = 't1_second';
table_name
t1_first
t1_second
SELECT DISTINCT table_schema FROM information_schema.tables
WHERE table_name IN (SELECT table_name FROM information_schema.tables
WHERE table_schema = 'db_datadict')
ORDER BY table_name;
table_schema
db_datadict
SELECT table_name FROM information_schema.tables t1
LEFT JOIN information_schema.tables t2 USING(table_name,table_schema)
WHERE t2.table_schema = 'db_datadict'
ORDER BY table_name;
table_name
t1_first
t1_second
USE test;
SELECT * FROM tables;
ERROR 42S02: Table 'test.tables' doesn't exist
#########################################################################
# Testcase 3.2.1.17+3.2.1.18
#########################################################################
DROP DATABASE IF EXISTS db_datadict;
CREATE DATABASE db_datadict;
CREATE TABLE db_datadict.t1 (f1 BIGINT UNIQUE, f2 BIGINT)
ENGINE = <some_engine>;
SELECT * FROM db_datadict.t1;
f1	f2
DROP   USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
DROP   USER 'testuser2'@'localhost';
CREATE USER 'testuser2'@'localhost';
GRANT CREATE VIEW,SELECT ON db_datadict.* TO testuser1@localhost
WITH GRANT OPTION;
GRANT USAGE ON db_datadict.* TO testuser2@localhost;
FLUSH PRIVILEGES;
GRANT SELECT on information_schema.* TO testuser1@localhost;
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT CREATE VIEW ON information_schema.* TO 'u_6_401018'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
# Establish connection testuser1 (user=testuser1)
SELECT table_schema,table_name FROM information_schema.tables
WHERE table_schema = 'information_schema' AND table_name = 'tables';
table_schema	table_name
information_schema	tables
SELECT * FROM information_schema.table_privileges
WHERE table_schema = 'information_schema';
GRANTEE	TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PRIVILEGE_TYPE	IS_GRANTABLE
SELECT * FROM information_schema.schema_privileges
WHERE table_schema = 'information_schema';
GRANTEE	TABLE_CATALOG	TABLE_SCHEMA	PRIVILEGE_TYPE	IS_GRANTABLE
CREATE VIEW db_datadict.v2 AS
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM information_schema.tables WHERE table_schema = 'db_datadict';
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM db_datadict.v2;
TABLE_SCHEMA	TABLE_NAME	TABLE_TYPE
db_datadict	t1	BASE TABLE
db_datadict	v2	VIEW
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM information_schema.tables WHERE table_schema = 'db_datadict';
TABLE_SCHEMA	TABLE_NAME	TABLE_TYPE
db_datadict	t1	BASE TABLE
db_datadict	v2	VIEW
GRANT SELECT ON db_datadict.v2 to testuser2@localhost;
# Establish connection testuser2 (user=testuser2)
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM db_datadict.v2;
TABLE_SCHEMA	TABLE_NAME	TABLE_TYPE
db_datadict	v2	VIEW
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
FROM information_schema.tables WHERE table_schema = 'db_datadict';
TABLE_SCHEMA	TABLE_NAME	TABLE_TYPE
db_datadict	v2	VIEW
# Switch to connection default and close connections testuser1 and testuser2
DROP USER 'testuser1'@'localhost';
DROP USER 'testuser2'@'localhost';
DROP DATABASE db_datadict;
#########################################################################
# Testcase 3.2.1.19
#########################################################################
DROP   USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
SELECT 'empty result set was expected' AS my_col
FROM information_schema.schema_privileges
WHERE table_schema = 'information_schema';
my_col
SELECT 'empty result set was expected' AS my_col
FROM information_schema.table_privileges
WHERE table_schema = 'information_schema';
my_col
SELECT 'empty result set was expected' AS my_col
FROM information_schema.column_privileges
WHERE table_schema = 'information_schema';
my_col
GRANT ALTER ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT ALTER ROUTINE ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT CREATE ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT CREATE ROUTINE ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT CREATE TEMPORARY TABLES ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT DELETE ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT DROP ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT EXECUTE ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT INDEX ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT INSERT ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT LOCK TABLES ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
GRANT UPDATE ON information_schema.*
TO 'testuser1'@'localhost';
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
SELECT 'empty result set was expected' AS my_col
FROM information_schema.schema_privileges
WHERE table_schema = 'information_schema';
my_col
SELECT 'empty result set was expected' AS my_col
FROM information_schema.table_privileges
WHERE table_schema = 'information_schema';
my_col
SELECT 'empty result set was expected' AS my_col
FROM information_schema.column_privileges
WHERE table_schema = 'information_schema';
my_col
DROP USER 'testuser1'@'localhost';
#########################################################################
# Testcase 3.2.1.16
#########################################################################
SELECT DISTINCT table_schema FROM information_schema.columns
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT table_schema FROM information_schema.column_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT constraint_schema,table_schema
FROM information_schema.key_column_usage
WHERE constraint_schema LIKE 'db_data%' OR table_schema LIKE 'db_data%';
constraint_schema	table_schema
SELECT DISTINCT routine_schema FROM information_schema.routines
WHERE routine_schema LIKE 'db_data%';
routine_schema
SELECT DISTINCT schema_name FROM information_schema.schemata
WHERE schema_name LIKE 'db_data%';
schema_name
SELECT DISTINCT table_schema FROM information_schema.schema_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT table_schema,index_schema FROM information_schema.statistics
WHERE table_schema LIKE 'db_data%' OR index_schema LIKE 'db_data%';
table_schema	index_schema
SELECT DISTINCT table_schema FROM information_schema.tables
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT constraint_schema,table_schema
FROM information_schema.table_constraints
WHERE constraint_schema LIKE 'db_data%' OR table_schema LIKE 'db_data%';
constraint_schema	table_schema
SELECT DISTINCT table_schema FROM information_schema.table_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT trigger_schema,event_object_schema
FROM information_schema.triggers
WHERE trigger_schema LIKE 'db_data%' OR event_object_schema LIKE 'db_data%';
trigger_schema	event_object_schema
SELECT DISTINCT table_schema FROM information_schema.views
WHERE table_schema LIKE 'db_data%';
table_schema
DROP DATABASE IF EXISTS db_datadict;
CREATE DATABASE db_datadict;
CREATE TABLE db_datadict.t1 (f1 BIGINT, f2 BIGINT NOT NULL, f3 BIGINT,
PRIMARY KEY(f1))
ENGINE = <some_engine>;
CREATE UNIQUE INDEX UIDX ON db_datadict.t1(f3);
CREATE PROCEDURE db_datadict.sproc1()      SELECT 'db_datadict';
CREATE FUNCTION db_datadict.func1() RETURNS INT RETURN 0;
CREATE TRIGGER db_datadict.trig1 BEFORE INSERT ON db_datadict.t1
FOR EACH ROW SET @aux = 1;
CREATE VIEW db_datadict.v1 AS SELECT * FROM db_datadict.t1;
CREATE VIEW db_datadict.v2 AS SELECT * FROM information_schema.tables;
SELECT DISTINCT table_schema FROM information_schema.columns
WHERE table_schema LIKE 'db_data%';
table_schema
db_datadict
SELECT DISTINCT table_schema FROM information_schema.column_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT constraint_schema,table_schema
FROM information_schema.key_column_usage
WHERE constraint_schema LIKE 'db_data%' OR table_schema LIKE 'db_data%';
constraint_schema	table_schema
db_datadict	db_datadict
SELECT DISTINCT routine_schema FROM information_schema.routines
WHERE routine_schema LIKE 'db_data%';
routine_schema
db_datadict
SELECT DISTINCT schema_name FROM information_schema.schemata
WHERE schema_name LIKE 'db_data%';
schema_name
db_datadict
SELECT DISTINCT table_schema FROM information_schema.schema_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT table_schema,index_schema FROM information_schema.statistics
WHERE table_schema LIKE 'db_data%' OR index_schema LIKE 'db_data%';
table_schema	index_schema
db_datadict	db_datadict
SELECT DISTINCT table_schema FROM information_schema.tables
WHERE table_schema LIKE 'db_data%';
table_schema
db_datadict
SELECT DISTINCT constraint_schema,table_schema
FROM information_schema.table_constraints
WHERE constraint_schema LIKE 'db_data%' OR table_schema LIKE 'db_data%';
constraint_schema	table_schema
db_datadict	db_datadict
SELECT DISTINCT table_schema FROM information_schema.table_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT trigger_schema,event_object_schema
FROM information_schema.triggers
WHERE trigger_schema LIKE 'db_data%' OR event_object_schema LIKE 'db_data%';
trigger_schema	event_object_schema
db_datadict	db_datadict
SELECT DISTINCT table_schema FROM information_schema.views
WHERE table_schema LIKE 'db_data%';
table_schema
db_datadict
DROP   USER 'testuser1'@'localhost';
CREATE USER 'testuser1'@'localhost';
GRANT ALL ON test.* TO 'testuser1'@'localhost';
# Establish connection testuser1 (user=testuser1)
SELECT DISTINCT table_schema FROM information_schema.columns
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT table_schema FROM information_schema.column_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT constraint_schema,table_schema
FROM information_schema.key_column_usage
WHERE constraint_schema LIKE 'db_data%' OR table_schema LIKE 'db_data%';
constraint_schema	table_schema
SELECT DISTINCT routine_schema FROM information_schema.routines
WHERE routine_schema LIKE 'db_data%';
routine_schema
SELECT DISTINCT schema_name FROM information_schema.schemata
WHERE schema_name LIKE 'db_data%';
schema_name
SELECT DISTINCT table_schema FROM information_schema.schema_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT table_schema,index_schema FROM information_schema.statistics
WHERE table_schema LIKE 'db_data%' OR index_schema LIKE 'db_data%';
table_schema	index_schema
SELECT DISTINCT table_schema FROM information_schema.tables
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT constraint_schema,table_schema
FROM information_schema.table_constraints
WHERE constraint_schema LIKE 'db_data%' OR table_schema LIKE 'db_data%';
constraint_schema	table_schema
SELECT DISTINCT table_schema FROM information_schema.table_privileges
WHERE table_schema LIKE 'db_data%';
table_schema
SELECT DISTINCT trigger_schema,event_object_schema
FROM information_schema.triggers
WHERE trigger_schema LIKE 'db_data%' OR event_object_schema LIKE 'db_data%';
trigger_schema	event_object_schema
SELECT DISTINCT table_schema FROM information_schema.views
WHERE table_schema LIKE 'db_data%';
table_schema
# Switch to connection default and close connections testuser1 and testuser2
DROP   USER 'testuser1'@'localhost';
DROP DATABASE db_datadict;
########################################################################
# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
#           DDL on INFORMATION_SCHEMA tables are not supported
########################################################################
DROP PROCEDURE IF EXISTS test.p1;
CREATE PROCEDURE test.p1()
INSERT INTO information_schema.tables
SELECT * FROM information_schema.tables LIMIT 1;
CALL test.p1();
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP PROCEDURE test.p1;
CREATE PROCEDURE test.p1()
UPDATE information_schema.columns SET table_schema = 'garbage';
CALL test.p1();
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP PROCEDURE test.p1;
CREATE PROCEDURE test.p1()
DELETE FROM information_schema.schemata;
CALL test.p1();
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
DROP PROCEDURE test.p1;
#########################################################################
# Testcase 3.2.17.1+3.2.17.2: To be implemented outside of this script
#########################################################################