MySQL  8.0.19
Source Code Documentation
metadata.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
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 "sql/dd/string_type.h" // dd::String_type
29 
30 class THD;
31 struct st_plugin_int;
32 
33 namespace dd {
34 namespace info_schema {
35 
36 /**
37  The version of the current information_schema system views.
38 
39  This version number is stored on disk in the data dictionary.
40  Every time the information_schema structure changes,
41  this version number must change.
42 
43  The numbering to use is the MySQL version number
44  of the first MySQL version that published a given database schema.
45  The format is Mmmdd with M=Major, m=minor, d=dot,
46  so that MySQL 8.0.4 is encoded as 80004.
47 
48  Historical I_S version number published:
49 
50  1: Published in 8.0.3-RC.
51  ------------------------
52  Introduced in MySQL 8.0.0 by WL#6599. Never published in a GA version.
53 
54  80011: Published in 8.0 GA.
55  ------------------------------------
56  Changes from version 1:
57 
58  - Bug#27309116: Add a new column `external_language` to `mysql`.`routines`
59  and update `information_schema`.`routines` to reflect this column.
60 
61  - Bug#27593348: INFORMATION_SCHEMA.STATISTICS FIELD TYPE CHANGE.
62  Changes the column I_S.STATISTICS.NON_UNIQUE type from VARCHAR
63  to INT.
64 
65  80012: Published in 8.0.12
66  ------------------------------------
67  Changes from version 80011:
68 
69  - Bug#27945704 UNABLE TO JOIN TABLE_CONSTRAINTS AND REFERENTIAL_CONSTRAINTS
70  Changes the collation of I_S columns that project index name and
71  constraint name to use utf8_tolower_ci.
72 
73  - WL#11864 Implement I_S.VIEW_TABLE_USAGE and I_S.VIEW_ROUTINE_USAGE
74 
75  - WL#1075 adds one column to INFORMATION_SCHEMA.STATISTICS: "EXPRESSION".
76  This column prints out the expression for functional key parts, or SQL NULL
77  if it is a regular key part. For functional key parts, COLUMN_NAME is set to
78  SQL NULL.
79 
80  80013: Published in 8.0.13
81  ------------------------------------
82  Changes from version 80012
83 
84  - WL#11000 ST_Distance with units
85  Adds a new view `information_schema`.`st_units_of_measure` with columns
86  `UNIT_NAME`, `CONVERSION_FACTOR`, `DESCRIPTION`, and `UNIT_TYPE`. This view
87  contains the supported spatial units.
88 
89  80014: Published in 8.0.14
90  ------------------------------------
91  There are no changes from version 80013. Hence server version 80014 used
92  I_S version 80013.
93 
94  80015: Not published.
95  ----------------------------------------------------------------------------
96  There are no changes from version 80014. Hence server version 80015 used
97  I_S version 80013.
98 
99  80016: Published in 8.0.16
100  ------------------------------------
101  Changes from version 80015.
102 
103  - WL#929 - CHECK CONSTRAINTS
104  New INFORMATION_SCHEMA table CHECK_CONSTRAINTS is introduced and
105  INFORMATION_SCHEMA.TABLE_CONSTRAINTS is modified to include check
106  constraints defined on the table.
107 
108  - WL#12261 Control (enforce and disable) table encryption
109  - Add new column information_schema.schemata.default_encryption
110  - information_schema.tables.options UDF definition is changed to pass
111  schema default encryption.
112 
113  80017: Published in 8.0.17
114  ------------------------------------
115  Changes from version 80016:
116 
117  - WL#12984 INFORMATION_SCHEMA and metadata related to secondary engine.
118  Changes system view definitions of
119  INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS and
120  INFORMATION_SCHEMA.COLUMNS.EXTRA.
121 
122  - Bug#29406053: OPTIMIZER_SWITCH DERIVED_MERGE=OFF CAUSES TABLE COMMENTS
123  "... IS NOT BASE TABLE"
124  Modifies the INFORMATION_SCHEMA.TABLES dynamic column definitions to
125  return NULL, if it finds a view.
126 
127  80018: Published in 8.0.18
128  ------------------------------------
129  Changes from version 80017:
130 
131  - Bug#28278220: wrong column type , view , binary
132  Changes type of following I_S table column's
133  KEY_COLUMN_USAGE: CONSTRAINT_NAME, POSITION_IN_UNIQUE_CONSTRAINT,
134  REFERENCED_TABLE_SCHEMA, FIELD_REFERENCED_TABLE_NAME,
135  REFERENCED_COLUMN_NAME
136 
137  TABLE_CONSTRAINTS: CONSTRAINT_NAME.
138  Column metadata of views on these system views or tables created using
139  CREATE TABLE SELECT from these system views will *not* be similar to one
140  created with previous version of system views.
141 
142  - Bug#29870919: INFORMATION SCHEMA STATS EXPIRY RESULTS IN BAD
143  STATS FOR PARTITIONED TABLES
144  This bug changes definition of I_S.STATISTICS.
145 
146  80019: Current
147  ------------------------------------
148  Changes from version 80018:
149 
150  - WL#10895 INFORMATION_SCHEMA views for Roles.
151  Adds new system view definitions for roles.
152  INFORMATION_SCHEMA.APPLICABLE_ROLES;
153  INFORMATION_SCHEMA.ADMINISTRABLE_ROLE_AUTHORIZATIONS;
154  INFORMATION_SCHEMA.ENABLED_ROLES;
155  INFORMATION_SCHEMA.ROLE_TABLE_GRANTS;
156  INFORMATION_SCHEMA.ROLE_COLUMN_GRANTS;
157  INFORMATION_SCHEMA.ROLE_ROUTINE_GRANTS;
158 
159  80020: Current
160  ------------------------------------
161  Changes from version 80019:
162 
163  - Bug#29871530: MYSQL 8.0 INFORMATION_SCHEMA.EVENTS NOT
164  OBSERVING CUSTOM TIMEZONE
165  This bug updates LAST_EXECUTED to include time zones in
166  I_S.EVENTS.
167 
168  80021: Next IS version number after the previous is public.
169  ------------------------------------
170 */
171 
172 static const uint IS_DD_VERSION = 80020;
173 
174 /**
175  Initialize INFORMATION_SCHEMA system views.
176 
177  @param thd Thread context.
178 
179  @return Upon failure, return true, otherwise false.
180 */
181 bool initialize(THD *thd);
182 
183 /**
184  Initialize non DD based INFORMATION_SCHEMA system views.
185 
186  @param thd Thread context.
187 
188  @return Upon failure, return true, otherwise false.
189 */
191 
192 /**
193  Create INFORMATION_SCHEMA system views.
194 
195  @param thd Thread context.
196 
197  @return Upon failure, return true, otherwise false.
198 */
199 bool create_system_views(THD *thd);
200 
201 /**
202  Store the server I_S table metadata into dictionary, once during MySQL
203  server bootstrap.
204 
205  @param thd Thread context.
206 
207  @return Upon failure, return true, otherwise false.
208 */
209 bool store_server_I_S_metadata(THD *thd);
210 
211 /**
212  Store I_S table metadata into dictionary, during MySQL server startup.
213 
214  @param thd Thread context.
215 
216  @return Upon failure, return true, otherwise false.
217 */
218 bool update_I_S_metadata(THD *thd);
219 
220 /**
221  Store dynamic I_S plugin table metadata into dictionary, during INSTALL
222  command execution.
223 
224  @param thd Thread context.
225  @param plugin_int I_S Plugin of which the metadata is to be stored.
226 
227  @return Upon failure, return true, otherwise false.
228 */
229 bool store_dynamic_plugin_I_S_metadata(THD *thd, st_plugin_int *plugin_int);
230 
231 /**
232  Remove I_S view metadata from dictionary. This is used
233  UNINSTALL and server restart procedure when I_S version is changed.
234 
235  @param thd Thread context.
236  @param view_name I_S view name of which the metadata is to be stored.
237 
238  @return Upon failure, return true, otherwise false.
239 */
240 bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name);
241 
242 /**
243  Get create view definition for the given I_S system view.
244 
245  @param schema_name Schema name.
246  @param view_name I_S view name.
247  @param definition [out] The CREATE VIEW command to create sytem view.
248  A pointer to a preallocated string should be
249  supplied.
250 
251  @return Upon failure, return true, otherwise false.
252 */
253 bool get_I_S_view_definition(const dd::String_type &schema_name,
254  const dd::String_type &view_name,
255  dd::String_type *definition);
256 
257 } // namespace info_schema
258 } // namespace dd
259 
260 #endif // SQL_DD_METADATA_H
dd::info_schema::IS_DD_VERSION
static const uint IS_DD_VERSION
The version of the current information_schema system views.
Definition: metadata.h:172
THD
Definition: sql_class.h:764
dd::String_type
Char_string_template< String_type_allocator > String_type
Definition: string_type.h:50
dd::info_schema::get_I_S_view_definition
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:718
dd
The version of the current data dictionary table definitions.
Definition: dictionary_client.h:39
dd::info_schema::store_dynamic_plugin_I_S_metadata
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:669
plugin.h
uint
unsigned int uint
Definition: uca-dump.cc:29
dd::info_schema::init_non_dd_based_system_view
bool init_non_dd_based_system_view(THD *thd)
Initialize non DD based INFORMATION_SCHEMA system views.
Definition: metadata.cc:713
string_type.h
dd::info_schema::initialize
bool initialize(THD *thd)
Initialize INFORMATION_SCHEMA system views.
Definition: metadata.cc:711
dd::info_schema::create_system_views
bool create_system_views(THD *thd)
Create INFORMATION_SCHEMA system views.
Definition: metadata.cc:631
dd::info_schema::store_server_I_S_metadata
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:637
st_plugin_int
Definition: sql_plugin_ref.h:44
dd::info_schema::update_I_S_metadata
bool update_I_S_metadata(THD *thd)
Store I_S table metadata into dictionary, during MySQL server startup.
Definition: metadata.cc:661
dd::info_schema::remove_I_S_view_metadata
bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name)
Remove I_S view metadata from dictionary.
Definition: metadata.cc:680