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