MySQL 8.3.0
Source Code Documentation
metadata.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2023, 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: Published in 8.0.29
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: Published in 8.0.30
222 ------------------------------------
223 Changes from version 80029:
224 - Bug #33787300 Rename utf8_xxx collations to utf8mb3_xxx
225
226 - WL#13784: Following INFORMATION_SCHEMA tables are modified to skip listing
227 generated invisible primary key and key column when system
228 variable show_gipk_in_create_table_and_information_schema = OFF,
229 INFORMATION_SCHEMA.COLUMNS
230 INFORMATION_SCHEMA.COLUMNS_EXTENSIONS
231 INFORMATION_SCHEMA.KEY_COLUMN_USAGE
232 INFORMATION_SCHEMA.STATISTICS
233 INFORMATION_SCHEMA.TABLE_CONSTRAINTS
234 INFORMATION_SCHEMA.TABLE_CONSTRAINTS_EXTENSIONS
235
236 80031..80033: Not published.
237 ----------------------------------------------------------------------------
238 There are no changes from version 80030. Hence server versions 80031..80033
239 uses I_S version 80030.
240
241 80034: Current
242 ----------------------------------------------------------------------------
243 Changes from version 80030:
244 - WL#15454: INFORMATION_SCHEMA.ROUTINES is modified so that ROUTINE_BODY
245 now depends on the value of EXTERNAL_LANGUAGE
246
247 80035: Next IS version number after the previous is public.
248 ------------------------------------
249 Changes from version 80035:
250
251 80200:
252 ----------------------------------------------------------------------------
253 Changes:
254 - WL#14190: Replace old terms in replication SQL commands on the SOURCE
255 Changed the status column of information_schema.events to show
256 correct terminology
257
258*/
259
260static const uint IS_DD_VERSION = 80200;
261static_assert((IS_DD_VERSION <= MYSQL_VERSION_ID) ||
262 ((IS_DD_VERSION == 800201) && (MYSQL_VERSION_ID >= 80020)),
263 "This release can not use a version number from the future");
264
265/**
266 Initialize INFORMATION_SCHEMA system views.
267
268 @param thd Thread context.
269
270 @return Upon failure, return true, otherwise false.
271*/
272bool initialize(THD *thd);
273
274/**
275 Initialize non DD based INFORMATION_SCHEMA system views.
276
277 @param thd Thread context.
278
279 @return Upon failure, return true, otherwise false.
280*/
282
283/**
284 Create INFORMATION_SCHEMA system views.
285
286 @param thd Thread context.
287
288 @return Upon failure, return true, otherwise false.
289*/
290bool create_system_views(THD *thd);
291
292/**
293 Store the server I_S table metadata into dictionary, once during MySQL
294 server bootstrap.
295
296 @param thd Thread context.
297
298 @return Upon failure, return true, otherwise false.
299*/
301
302/**
303 Store I_S table metadata into dictionary, during MySQL server startup.
304
305 @param thd Thread context.
306
307 @return Upon failure, return true, otherwise false.
308*/
309bool update_I_S_metadata(THD *thd);
310
311/**
312 Store dynamic I_S plugin table metadata into dictionary, during INSTALL
313 command execution.
314
315 @param thd Thread context.
316 @param plugin_int I_S Plugin of which the metadata is to be stored.
317
318 @return Upon failure, return true, otherwise false.
319*/
321
322/**
323 Remove I_S view metadata from dictionary. This is used
324 UNINSTALL and server restart procedure when I_S version is changed.
325
326 @param thd Thread context.
327 @param view_name I_S view name of which the metadata is to be stored.
328
329 @return Upon failure, return true, otherwise false.
330*/
331bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name);
332
333/**
334 Get create view definition for the given I_S system view.
335
336 @param schema_name Schema name.
337 @param view_name I_S view name.
338 @param definition [out] The CREATE VIEW command to create system view.
339 A pointer to a preallocated string should be
340 supplied.
341
342 @return Upon failure, return true, otherwise false.
343*/
344bool get_I_S_view_definition(const dd::String_type &schema_name,
345 const dd::String_type &view_name,
346 dd::String_type *definition);
347
348} // namespace info_schema
349} // namespace dd
350
351#endif // SQL_DD_METADATA_H
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:35
#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:615
bool init_non_dd_based_system_view(THD *thd)
Initialize non DD based INFORMATION_SCHEMA system views.
Definition: metadata.cc:691
bool initialize(THD *thd)
Initialize INFORMATION_SCHEMA system views.
Definition: metadata.cc:689
static const uint IS_DD_VERSION
The version of the current information_schema system views.
Definition: metadata.h:260
bool create_system_views(THD *thd)
Create INFORMATION_SCHEMA system views.
Definition: metadata.cc:609
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:647
bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name)
Remove I_S view metadata from dictionary.
Definition: metadata.cc:658
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:696
bool update_I_S_metadata(THD *thd)
Store I_S table metadata into dictionary, during MySQL server startup.
Definition: metadata.cc:639
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