MySQL 8.0.29
Source Code Documentation
metadata.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2022, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is also distributed with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef SQL_DD_METADATA_H
24#define SQL_DD_METADATA_H
25
26#include <mysql/plugin.h> // st_plugin_int
27
28#include "mysql_version.h" // MYSQL_VERSION_ID
29#include "sql/dd/string_type.h" // dd::String_type
30
31class THD;
32struct st_plugin_int;
33
34namespace dd {
35namespace info_schema {
36
37/**
38 The version of the current information_schema system views.
39
40 This version number is stored on disk in the data dictionary.
41 Every time the information_schema structure changes,
42 this version number must change.
43
44 The numbering to use is the MySQL version number
45 of the first MySQL version that published a given database schema.
46 The format is Mmmdd with M=Major, m=minor, d=dot,
47 so that MySQL 8.0.4 is encoded as 80004.
48
49 Historical I_S version number published:
50
51 1: Published in 8.0.3-RC.
52 ------------------------
53 Introduced in MySQL 8.0.0 by WL#6599. Never published in a GA version.
54
55 80011: Published in 8.0 GA.
56 ------------------------------------
57 Changes from version 1:
58
59 - Bug#27309116: Add a new column `external_language` to `mysql`.`routines`
60 and update `information_schema`.`routines` to reflect this column.
61
62 - Bug#27593348: INFORMATION_SCHEMA.STATISTICS FIELD TYPE CHANGE.
63 Changes the column I_S.STATISTICS.NON_UNIQUE type from VARCHAR
64 to INT.
65
66 80012: Published in 8.0.12
67 ------------------------------------
68 Changes from version 80011:
69
70 - Bug#27945704 UNABLE TO JOIN TABLE_CONSTRAINTS AND REFERENTIAL_CONSTRAINTS
71 Changes the collation of I_S columns that project index name and
72 constraint name to use utf8_tolower_ci.
73
74 - WL#11864 Implement I_S.VIEW_TABLE_USAGE and I_S.VIEW_ROUTINE_USAGE
75
76 - WL#1075 adds one column to INFORMATION_SCHEMA.STATISTICS: "EXPRESSION".
77 This column prints out the expression for functional key parts, or SQL NULL
78 if it is a regular key part. For functional key parts, COLUMN_NAME is set to
79 SQL NULL.
80
81 80013: Published in 8.0.13
82 ------------------------------------
83 Changes from version 80012
84
85 - WL#11000 ST_Distance with units
86 Adds a new view `information_schema`.`st_units_of_measure` with columns
87 `UNIT_NAME`, `CONVERSION_FACTOR`, `DESCRIPTION`, and `UNIT_TYPE`. This view
88 contains the supported spatial units.
89
90 80014: Published in 8.0.14
91 ------------------------------------
92 There are no changes from version 80013. Hence server version 80014 used
93 I_S version 80013.
94
95 80015: Not published.
96 ----------------------------------------------------------------------------
97 There are no changes from version 80014. Hence server version 80015 used
98 I_S version 80013.
99
100 80016: Published in 8.0.16
101 ------------------------------------
102 Changes from version 80015.
103
104 - WL#929 - CHECK CONSTRAINTS
105 New INFORMATION_SCHEMA table CHECK_CONSTRAINTS is introduced and
106 INFORMATION_SCHEMA.TABLE_CONSTRAINTS is modified to include check
107 constraints defined on the table.
108
109 - WL#12261 Control (enforce and disable) table encryption
110 - Add new column information_schema.schemata.default_encryption
111 - information_schema.tables.options UDF definition is changed to pass
112 schema default encryption.
113
114 80017: Published in 8.0.17
115 ------------------------------------
116 Changes from version 80016:
117
118 - WL#12984 INFORMATION_SCHEMA and metadata related to secondary engine.
119 Changes system view definitions of
120 INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS and
121 INFORMATION_SCHEMA.COLUMNS.EXTRA.
122
123 - Bug#29406053: OPTIMIZER_SWITCH DERIVED_MERGE=OFF CAUSES TABLE COMMENTS
124 "... IS NOT BASE TABLE"
125 Modifies the INFORMATION_SCHEMA.TABLES dynamic column definitions to
126 return NULL, if it finds a view.
127
128 80018: Published in 8.0.18
129 ------------------------------------
130 Changes from version 80017:
131
132 - Bug#28278220: wrong column type , view , binary
133 Changes type of following I_S table column's
134 KEY_COLUMN_USAGE: CONSTRAINT_NAME, POSITION_IN_UNIQUE_CONSTRAINT,
135 REFERENCED_TABLE_SCHEMA, FIELD_REFERENCED_TABLE_NAME,
136 REFERENCED_COLUMN_NAME
137
138 TABLE_CONSTRAINTS: CONSTRAINT_NAME.
139 Column metadata of views on these system views or tables created using
140 CREATE TABLE SELECT from these system views will *not* be similar to one
141 created with previous version of system views.
142
143 - Bug#29870919: INFORMATION SCHEMA STATS EXPIRY RESULTS IN BAD
144 STATS FOR PARTITIONED TABLES
145 This bug changes definition of I_S.STATISTICS.
146
147 80019: Not published (see below)
148 ------------------------------------
149 Changes from version 80018:
150
151 - WL#10895 INFORMATION_SCHEMA views for Roles.
152 Adds new system view definitions for roles.
153 INFORMATION_SCHEMA.APPLICABLE_ROLES;
154 INFORMATION_SCHEMA.ADMINISTRABLE_ROLE_AUTHORIZATIONS;
155 INFORMATION_SCHEMA.ENABLED_ROLES;
156 INFORMATION_SCHEMA.ROLE_TABLE_GRANTS;
157 INFORMATION_SCHEMA.ROLE_COLUMN_GRANTS;
158 INFORMATION_SCHEMA.ROLE_ROUTINE_GRANTS;
159
160 80020: Published by mistake in server version 8.0.19. To correct this,
161 we set the IS version number to 800201 in mysql server version 8.0.20.
162 Then, in server version 8.0.21, we're back on track with IS_version 80021.
163 ------------------------------------
164 Changes from version 80018:
165
166 - Bug#29871530: MYSQL 8.0 INFORMATION_SCHEMA.EVENTS NOT
167 OBSERVING CUSTOM TIMEZONE
168 This bug updates LAST_EXECUTED to include time zones in
169 I_S.EVENTS.
170
171 800201: Published in 8.0.20
172 ------------------------------------
173 Changes from version 80020:
174
175 - Bug#30263373: INCORRECT OUTPUT FROM TABLE_FUNCTION_JSON::PRINT()
176 This bug updates the character set of columns returned from JSON_TABLE
177 expressions in INFORMATION_SCHEMA views.
178
179 80021: Published in 8.0.21
180 ------------------------------------
181 Changes from version 800201:
182
183 - WL#13562 CREATE/ALTER USER COMMENT 'JSON'
184
185 - WL#13341: Store options for secondary engines.
186
187 - Bug#30766181 and Bug#30216864 updates I_S.KEY_COLUMN_USAGE and
188 I_S.TABLE_CONSTRAINTS views.
189
190 80022: Published in 8.0.22
191 ------------------------------------
192 Changes from version 80021:
193
194 - WL#13369: Added new I_S view 'SCHEMATA_EXTENSIONS'.
195 - Bug #31427410: Added a WHERE clause to I_S.USER_ATTRIBUTES
196
197 80023: Published in 8.0.23
198 ------------------------------------
199 Changes from version 80022:
200
201 - WL#12819: Affects size of I_S.KEYWORDS.WORD column length.
202 Following bug was raised for the same.
203 Bug#31982157 THE KEYWORD LEN IN I_S GETS UPDATED WHEN
204 A KEYWORD > EXISTING MAX LEN IS ADDED
205
206 - WL#10905: INFORMATION_SCHEMA.COLUMNS table is modified to list "INVISIBLE"
207 value in EXTRA column for INVISIBLE columns.
208
209 80024..80028: Not published.
210 ----------------------------------------------------------------------------
211 There are no changes from version 80023. Hence server versions 80024..80028
212 uses I_S version 80023.
213
214 80029: Current.
215 ------------------------------------
216 Changes from version 80023:
217
218 - Bug#33781534: INFORMATION_SCHEMA.KEY_COLUMN_USAGE table is modified to
219 list invisible columns with key constraints.
220
221 80030: Next IS version number after the previous is public.
222 ------------------------------------
223 Changes from version 80029:
224*/
225
226static const uint IS_DD_VERSION = 80029;
227static_assert((IS_DD_VERSION <= MYSQL_VERSION_ID) ||
228 ((IS_DD_VERSION == 800201) && (MYSQL_VERSION_ID >= 80020)),
229 "This release can not use a version number from the future");
230
231/**
232 Initialize INFORMATION_SCHEMA system views.
233
234 @param thd Thread context.
235
236 @return Upon failure, return true, otherwise false.
237*/
238bool initialize(THD *thd);
239
240/**
241 Initialize non DD based INFORMATION_SCHEMA system views.
242
243 @param thd Thread context.
244
245 @return Upon failure, return true, otherwise false.
246*/
248
249/**
250 Create INFORMATION_SCHEMA system views.
251
252 @param thd Thread context.
253
254 @return Upon failure, return true, otherwise false.
255*/
256bool create_system_views(THD *thd);
257
258/**
259 Store the server I_S table metadata into dictionary, once during MySQL
260 server bootstrap.
261
262 @param thd Thread context.
263
264 @return Upon failure, return true, otherwise false.
265*/
267
268/**
269 Store I_S table metadata into dictionary, during MySQL server startup.
270
271 @param thd Thread context.
272
273 @return Upon failure, return true, otherwise false.
274*/
275bool update_I_S_metadata(THD *thd);
276
277/**
278 Store dynamic I_S plugin table metadata into dictionary, during INSTALL
279 command execution.
280
281 @param thd Thread context.
282 @param plugin_int I_S Plugin of which the metadata is to be stored.
283
284 @return Upon failure, return true, otherwise false.
285*/
287
288/**
289 Remove I_S view metadata from dictionary. This is used
290 UNINSTALL and server restart procedure when I_S version is changed.
291
292 @param thd Thread context.
293 @param view_name I_S view name of which the metadata is to be stored.
294
295 @return Upon failure, return true, otherwise false.
296*/
297bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name);
298
299/**
300 Get create view definition for the given I_S system view.
301
302 @param schema_name Schema name.
303 @param view_name I_S view name.
304 @param definition [out] The CREATE VIEW command to create sytem view.
305 A pointer to a preallocated string should be
306 supplied.
307
308 @return Upon failure, return true, otherwise false.
309*/
310bool get_I_S_view_definition(const dd::String_type &schema_name,
311 const dd::String_type &view_name,
312 dd::String_type *definition);
313
314} // namespace info_schema
315} // namespace dd
316
317#endif // SQL_DD_METADATA_H
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:945
#define MYSQL_VERSION_ID
Definition: mysql_version.h:15
bool store_server_I_S_metadata(THD *thd)
Store the server I_S table metadata into dictionary, once during MySQL server bootstrap.
Definition: metadata.cc:607
bool init_non_dd_based_system_view(THD *thd)
Initialize non DD based INFORMATION_SCHEMA system views.
Definition: metadata.cc:683
bool initialize(THD *thd)
Initialize INFORMATION_SCHEMA system views.
Definition: metadata.cc:681
static const uint IS_DD_VERSION
The version of the current information_schema system views.
Definition: metadata.h:226
bool create_system_views(THD *thd)
Create INFORMATION_SCHEMA system views.
Definition: metadata.cc:601
bool store_dynamic_plugin_I_S_metadata(THD *thd, st_plugin_int *plugin_int)
Store dynamic I_S plugin table metadata into dictionary, during INSTALL command execution.
Definition: metadata.cc:639
bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name)
Remove I_S view metadata from dictionary.
Definition: metadata.cc:650
bool get_I_S_view_definition(const dd::String_type &schema_name, const dd::String_type &view_name, dd::String_type *definition)
Get create view definition for the given I_S system view.
Definition: metadata.cc:688
bool update_I_S_metadata(THD *thd)
Store I_S table metadata into dictionary, during MySQL server startup.
Definition: metadata.cc:631
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:42
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
Definition: sql_plugin_ref.h:44
unsigned int uint
Definition: uca-dump.cc:29