MySQL 8.0.39
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: Current.
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: Next IS version number after the previous is public.
238 ------------------------------------
239 Changes from version 80030:
240*/
241
242static const uint IS_DD_VERSION = 80030;
243static_assert((IS_DD_VERSION <= MYSQL_VERSION_ID) ||
244 ((IS_DD_VERSION == 800201) && (MYSQL_VERSION_ID >= 80020)),
245 "This release can not use a version number from the future");
246
247/**
248 Initialize INFORMATION_SCHEMA system views.
249
250 @param thd Thread context.
251
252 @return Upon failure, return true, otherwise false.
253*/
254bool initialize(THD *thd);
255
256/**
257 Initialize non DD based INFORMATION_SCHEMA system views.
258
259 @param thd Thread context.
260
261 @return Upon failure, return true, otherwise false.
262*/
264
265/**
266 Create INFORMATION_SCHEMA system views.
267
268 @param thd Thread context.
269
270 @return Upon failure, return true, otherwise false.
271*/
272bool create_system_views(THD *thd);
273
274/**
275 Store the server I_S table metadata into dictionary, once during MySQL
276 server bootstrap.
277
278 @param thd Thread context.
279
280 @return Upon failure, return true, otherwise false.
281*/
283
284/**
285 Store I_S table metadata into dictionary, during MySQL server startup.
286
287 @param thd Thread context.
288
289 @return Upon failure, return true, otherwise false.
290*/
291bool update_I_S_metadata(THD *thd);
292
293/**
294 Store dynamic I_S plugin table metadata into dictionary, during INSTALL
295 command execution.
296
297 @param thd Thread context.
298 @param plugin_int I_S Plugin of which the metadata is to be stored.
299
300 @return Upon failure, return true, otherwise false.
301*/
303
304/**
305 Remove I_S view metadata from dictionary. This is used
306 UNINSTALL and server restart procedure when I_S version is changed.
307
308 @param thd Thread context.
309 @param view_name I_S view name of which the metadata is to be stored.
310
311 @return Upon failure, return true, otherwise false.
312*/
313bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name);
314
315/**
316 Get create view definition for the given I_S system view.
317
318 @param schema_name Schema name.
319 @param view_name I_S view name.
320 @param definition [out] The CREATE VIEW command to create system view.
321 A pointer to a preallocated string should be
322 supplied.
323
324 @return Upon failure, return true, otherwise false.
325*/
326bool get_I_S_view_definition(const dd::String_type &schema_name,
327 const dd::String_type &view_name,
328 dd::String_type *definition);
329
330} // namespace info_schema
331} // namespace dd
332
333#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:34
#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:614
bool init_non_dd_based_system_view(THD *thd)
Initialize non DD based INFORMATION_SCHEMA system views.
Definition: metadata.cc:690
bool initialize(THD *thd)
Initialize INFORMATION_SCHEMA system views.
Definition: metadata.cc:688
static const uint IS_DD_VERSION
The version of the current information_schema system views.
Definition: metadata.h:242
bool create_system_views(THD *thd)
Create INFORMATION_SCHEMA system views.
Definition: metadata.cc:608
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:646
bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name)
Remove I_S view metadata from dictionary.
Definition: metadata.cc:657
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:695
bool update_I_S_metadata(THD *thd)
Store I_S table metadata into dictionary, during MySQL server startup.
Definition: metadata.cc:638
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
unsigned int uint
Definition: uca9-dump.cc:75