~vadim-tk/percona-server/flushing-algo

« back to all changes in this revision

Viewing changes to mysql-test/suite/funcs_1/t/is_events.test

  • Committer: root
  • Date: 2011-10-29 01:34:40 UTC
  • Revision ID: root@hppro1.office.percona.com-20111029013440-qhnf4jk8kdjcf4e0
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# suite/funcs_1/t/is_events.test
 
2
#
 
3
# Check the layout of information_schema.events and some functionality of it.
 
4
#
 
5
#    This test is not intended for checking storage engine properties
 
6
#    Therefore please do not alter $engine_type and $other_engine_type.
 
7
#
 
8
# Author:
 
9
# 2008-02-29 mleich WL#4203 Reorganize and fix the data dictionary tests of
 
10
#                           testsuite funcs_1
 
11
#
 
12
 
 
13
if (`SELECT VERSION() LIKE '%embedded%'`)
 
14
{
 
15
   --skip Bug#37456 funcs_1: Several tests crash when used with embedded server
 
16
}
 
17
 
 
18
let $engine_type       = MEMORY;
 
19
let $other_engine_type = MyISAM;
 
20
 
 
21
let $is_table = EVENTS;
 
22
 
 
23
# The table INFORMATION_SCHEMA.EVENTS must exist
 
24
eval SHOW TABLES FROM information_schema LIKE '$is_table';
 
25
 
 
26
--echo #######################################################################
 
27
--echo # Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
 
28
--echo #######################################################################
 
29
# Ensure that every INFORMATION_SCHEMA table can be queried with a SELECT
 
30
# statement, just as if it were an ordinary user-defined table.
 
31
#
 
32
--source suite/funcs_1/datadict/is_table_query.inc
 
33
 
 
34
 
 
35
--echo #########################################################################
 
36
--echo # Testcase 3.2.12.1: INFORMATION_SCHEMA.EVENTS layout
 
37
--echo #########################################################################
 
38
# Ensure that the INFORMATION_SCHEMA.EVENTS table has the following columns,
 
39
# in the following order:
 
40
#
 
41
# EVENT_CATALOG       always NULL
 
42
# EVENT_SCHEMA        The name of the schema (database) to which this
 
43
#                     event belongs.
 
44
# EVENT_NAME          The name of the event.
 
45
# DEFINER             The user who created the event.
 
46
#                     'user_name'@'host_name'  format!
 
47
# TIME_ZONE           The time zone in effect when schedule for the event was
 
48
#                     last modified
 
49
# EVENT_BODY          The language used for the statements in the event's
 
50
#                     DO clause. (always SQL)
 
51
# EVENT_DEFINITION    The text of the SQL statement making up the event's
 
52
#                     DO clause.
 
53
# EVENT_TYPE          One of the two values ONE TIME or RECURRING.
 
54
# EXECUTE_AT          one-time event: DATETIME value specified in the AT clause
 
55
#                                     of the CREATE EVENT statement used to
 
56
#                                     create the event
 
57
#                     or of the last ALTER EVENT statement that modified
 
58
#                     the event.
 
59
# INTERVAL_VALUE      recurring events; numeric portion of the event's
 
60
#                     EVERY clause.
 
61
# INTERVAL_FIELD      recurring events: units portion of the EVERY clause
 
62
#                     governing the timing of the event, prefixed with
 
63
#                     'INTERVAL_'.  Example: 'INTERVAL_DAY'
 
64
# SQL_MODE            The SQL mode in effect at the time the event was created
 
65
#                     or altered.
 
66
# STARTS              For recurring event whose definition includes a STARTS
 
67
#                     clause, this column contains the corresponding
 
68
#                     DATETIME value. If there is no STARTS clause affecting
 
69
#                     the timing of the event, this column is empty.
 
70
# ENDS                For a recurring event whose definition includes a ENDS
 
71
#                     clause, this column contains the corresponding DATETIME
 
72
#                     value. If there is no ENDS clause affecting the timing
 
73
#                     of the event, this column contains NULL.
 
74
# STATUS              ENABLED, DISABLED or SLAVESIDE_DISABLED
 
75
# ON_COMPLETION       PRESERVE or NOT PRESERVE.
 
76
# CREATED             Date and time of event creation
 
77
# LAST_ALTERED        Date and time of the last event modification
 
78
#                     never modified -> value = CREATED
 
79
# LAST_EXECUTED       Date and time of start of last event execution
 
80
#                     never executed -> value IS NULL.
 
81
# EVENT_COMMENT       The text of a comment. Default: empty string.
 
82
# ORIGINATOR          The server ID of the MySQL server on which the event was
 
83
#                     created; used in replication. Default: 0
 
84
# CHARACTER_SET_CLIENT Session value of the character_set_client system variable
 
85
#                      when the event was created.
 
86
# COLLATION_CONNECTION Session value of the collation_connection system
 
87
#                      variable when the event was created.
 
88
# DATABASE_COLLATION  Collation of the database with which the event
 
89
#                     is associated.
 
90
#
 
91
eval DESCRIBE          information_schema.$is_table;
 
92
eval SHOW CREATE TABLE information_schema.$is_table;
 
93
eval SHOW COLUMNS FROM information_schema.$is_table;
 
94
 
 
95
# Note: Retrieval of information within information_schema.columns about
 
96
#       information_schema.events is in is_columns_is.test.
 
97
 
 
98
# Check event_catalog event_body, event_type, event_type, status, on_completion
 
99
SELECT event_catalog, event_name, event_body, event_type, event_type,
 
100
       status, on_completion
 
101
FROM information_schema.events
 
102
WHERE event_catalog IS NOT NULL or
 
103
      event_body NOT IN ('SQL') or
 
104
      event_type NOT IN ('ONE TIME','RECURRING') or
 
105
      status NOT IN ('ENABLED','DISABLED','SLAVESIDE_DISABLED') or
 
106
      on_completion NOT IN ('PRESERVE','NOT PRESERVE');
 
107
 
 
108
# FIXME:  Check the regression tests and implement tests checking the
 
109
#         functionality if missing.
 
110
 
 
111
 
 
112
--echo ########################################################################
 
113
--echo # Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
 
114
--echo #           DDL on INFORMATION_SCHEMA tables are not supported
 
115
--echo ########################################################################
 
116
# 3.2.1.3:  Ensure that no user may execute an INSERT statement on any
 
117
#           INFORMATION_SCHEMA table.
 
118
# 3.2.1.4:  Ensure that no user may execute an UPDATE statement on any
 
119
#           INFORMATION_SCHEMA table.
 
120
# 3.2.1.5:  Ensure that no user may execute a DELETE statement on any
 
121
#           INFORMATION_SCHEMA table.
 
122
# 3.2.1.8:  Ensure that no user may create an index on an
 
123
#           INFORMATION_SCHEMA table.
 
124
# 3.2.1.9:  Ensure that no user may alter the definition of an
 
125
#           INFORMATION_SCHEMA table.
 
126
# 3.2.1.10: Ensure that no user may drop an INFORMATION_SCHEMA table.
 
127
# 3.2.1.11: Ensure that no user may move an INFORMATION_SCHEMA table to any
 
128
#           other database.
 
129
# 3.2.1.12: Ensure that no user may directly add to, alter, or delete any data
 
130
#           in an INFORMATION_SCHEMA table.
 
131
#
 
132
--disable_warnings
 
133
DROP DATABASE IF EXISTS db_datadict;
 
134
--enable_warnings
 
135
CREATE DATABASE db_datadict;
 
136
--replace_result $engine_type <engine_type>
 
137
eval
 
138
CREATE TABLE db_datadict.t1 (f1 BIGINT)
 
139
ENGINE = $engine_type;
 
140
 
 
141
--error ER_DBACCESS_DENIED_ERROR
 
142
INSERT INTO information_schema.events
 
143
SELECT * FROM information_schema.events;
 
144
 
 
145
--error ER_DBACCESS_DENIED_ERROR
 
146
UPDATE information_schema.events SET event_name = '1234567'
 
147
WHERE table_name = 't1';
 
148
 
 
149
--error ER_DBACCESS_DENIED_ERROR
 
150
DELETE FROM information_schema.events WHERE event_catalog IS NULL;
 
151
--error ER_DBACCESS_DENIED_ERROR
 
152
TRUNCATE information_schema.events;
 
153
 
 
154
--error ER_DBACCESS_DENIED_ERROR
 
155
CREATE INDEX my_idx_on_events ON information_schema.events(event_name);
 
156
 
 
157
--error ER_DBACCESS_DENIED_ERROR
 
158
ALTER TABLE information_schema.events DROP PRIMARY KEY;
 
159
--error ER_DBACCESS_DENIED_ERROR
 
160
ALTER TABLE information_schema.events ADD f1 INT;
 
161
 
 
162
--error ER_DBACCESS_DENIED_ERROR
 
163
DROP TABLE information_schema.events;
 
164
 
 
165
--error ER_DBACCESS_DENIED_ERROR
 
166
ALTER TABLE information_schema.events RENAME db_datadict.events;
 
167
--error ER_DBACCESS_DENIED_ERROR
 
168
ALTER TABLE information_schema.events RENAME information_schema.xevents;
 
169
 
 
170
# Cleanup
 
171
DROP DATABASE db_datadict;
 
172