File: metadata.h

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (333 lines) | stat: -rw-r--r-- 11,826 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
/* Copyright (c) 2017, 2025, Oracle and/or its affiliates.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License, version 2.0,
   as published by the Free Software Foundation.

   This program is designed to work with certain software (including
   but not limited to OpenSSL) that is licensed under separate terms,
   as designated in a particular file or component or in included license
   documentation.  The authors of MySQL hereby grant you an additional
   permission to link the program and your derivative works with the
   separately licensed software that they have either included with
   the program or referenced in the documentation.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License, version 2.0, for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */

#ifndef SQL_DD_METADATA_H
#define SQL_DD_METADATA_H

#include <mysql/plugin.h>  // st_plugin_int

#include "mysql_version.h"       // MYSQL_VERSION_ID
#include "sql/dd/string_type.h"  // dd::String_type

class THD;
struct st_plugin_int;

namespace dd {
namespace info_schema {

/**
  The version of the current information_schema system views.

  This version number is stored on disk in the data dictionary.
  Every time the information_schema structure changes,
  this version number must change.

  The numbering to use is the MySQL version number
  of the first MySQL version that published a given database schema.
  The format is Mmmdd with M=Major, m=minor, d=dot,
  so that MySQL 8.0.4 is encoded as 80004.

  Historical I_S version number published:

  1: Published in 8.0.3-RC.
  ------------------------
  Introduced in MySQL 8.0.0 by WL#6599. Never published in a GA version.

  80011: Published in 8.0 GA.
  ------------------------------------
  Changes from version 1:

  - Bug#27309116: Add a new column `external_language` to `mysql`.`routines`
    and update `information_schema`.`routines` to reflect this column.

  - Bug#27593348: INFORMATION_SCHEMA.STATISTICS FIELD TYPE CHANGE.
    Changes the column I_S.STATISTICS.NON_UNIQUE type from VARCHAR
    to INT.

  80012: Published in 8.0.12
  ------------------------------------
  Changes from version 80011:

  - Bug#27945704 UNABLE TO JOIN TABLE_CONSTRAINTS AND REFERENTIAL_CONSTRAINTS
    Changes the collation of I_S columns that project index name and
    constraint name to use utf8_tolower_ci.

  - WL#11864 Implement I_S.VIEW_TABLE_USAGE and I_S.VIEW_ROUTINE_USAGE

  - WL#1075 adds one column to INFORMATION_SCHEMA.STATISTICS: "EXPRESSION".
    This column prints out the expression for functional key parts, or SQL NULL
    if it is a regular key part. For functional key parts, COLUMN_NAME is set to
    SQL NULL.

  80013: Published in 8.0.13
  ------------------------------------
  Changes from version 80012

  - WL#11000 ST_Distance with units
    Adds a new view `information_schema`.`st_units_of_measure` with columns
    `UNIT_NAME`, `CONVERSION_FACTOR`, `DESCRIPTION`, and `UNIT_TYPE`. This view
    contains the supported spatial units.

  80014: Published in 8.0.14
  ------------------------------------
  There are no changes from version 80013. Hence server version 80014 used
  I_S version 80013.

  80015: Not published.
  ----------------------------------------------------------------------------
  There are no changes from version 80014. Hence server version 80015 used
  I_S version 80013.

  80016: Published in 8.0.16
  ------------------------------------
  Changes from version 80015.

  - WL#929 - CHECK CONSTRAINTS
    New INFORMATION_SCHEMA table CHECK_CONSTRAINTS is introduced and
    INFORMATION_SCHEMA.TABLE_CONSTRAINTS is modified to include check
    constraints defined on the table.

  - WL#12261 Control (enforce and disable) table encryption
    - Add new column information_schema.schemata.default_encryption
    - information_schema.tables.options UDF definition is changed to pass
      schema default encryption.

  80017: Published in 8.0.17
  ------------------------------------
  Changes from version 80016:

  - WL#12984 INFORMATION_SCHEMA and metadata related to secondary engine.
    Changes system view definitions of
    INFORMATION_SCHEMA.TABLES.CREATE_OPTIONS and
  INFORMATION_SCHEMA.COLUMNS.EXTRA.

  - Bug#29406053: OPTIMIZER_SWITCH DERIVED_MERGE=OFF CAUSES TABLE COMMENTS
                  "... IS NOT BASE TABLE"
    Modifies the INFORMATION_SCHEMA.TABLES dynamic column definitions to
    return NULL, if it finds a view.

  80018: Published in 8.0.18
  ------------------------------------
  Changes from version 80017:

  - Bug#28278220: wrong column type , view , binary
    Changes type of following I_S table column's
      KEY_COLUMN_USAGE:    CONSTRAINT_NAME, POSITION_IN_UNIQUE_CONSTRAINT,
                           REFERENCED_TABLE_SCHEMA, FIELD_REFERENCED_TABLE_NAME,
                           REFERENCED_COLUMN_NAME

      TABLE_CONSTRAINTS:   CONSTRAINT_NAME.
    Column metadata of views on these system views or tables created using
    CREATE TABLE SELECT from these system views will *not* be similar to one
    created with previous version of system views.

  - Bug#29870919: INFORMATION SCHEMA STATS EXPIRY RESULTS IN BAD
                  STATS FOR PARTITIONED TABLES
    This bug changes definition of I_S.STATISTICS.

  80019: Not published (see below)
  ------------------------------------
  Changes from version 80018:

  - WL#10895 INFORMATION_SCHEMA views for Roles.
    Adds new system view definitions for roles.
       INFORMATION_SCHEMA.APPLICABLE_ROLES;
       INFORMATION_SCHEMA.ADMINISTRABLE_ROLE_AUTHORIZATIONS;
       INFORMATION_SCHEMA.ENABLED_ROLES;
       INFORMATION_SCHEMA.ROLE_TABLE_GRANTS;
       INFORMATION_SCHEMA.ROLE_COLUMN_GRANTS;
       INFORMATION_SCHEMA.ROLE_ROUTINE_GRANTS;

  80020: Published by mistake in server version 8.0.19. To correct this,
  we set the IS version number to 800201 in mysql server version 8.0.20.
  Then, in server version 8.0.21, we're back on track with IS_version 80021.
  ------------------------------------
  Changes from version 80018:

  - Bug#29871530: MYSQL 8.0 INFORMATION_SCHEMA.EVENTS NOT
                  OBSERVING CUSTOM TIMEZONE
    This bug updates LAST_EXECUTED to include time zones in
    I_S.EVENTS.

  800201: Published in 8.0.20
  ------------------------------------
  Changes from version 80020:

  - Bug#30263373: INCORRECT OUTPUT FROM TABLE_FUNCTION_JSON::PRINT()
    This bug updates the character set of columns returned from JSON_TABLE
    expressions in INFORMATION_SCHEMA views.

  80021: Published in 8.0.21
  ------------------------------------
  Changes from version 800201:

     - WL#13562 CREATE/ALTER USER COMMENT 'JSON'

     - WL#13341: Store options for secondary engines.

     - Bug#30766181 and Bug#30216864 updates I_S.KEY_COLUMN_USAGE and
       I_S.TABLE_CONSTRAINTS views.

  80022: Published in 8.0.22
  ------------------------------------
  Changes from version 80021:

  - WL#13369: Added new I_S view 'SCHEMATA_EXTENSIONS'.
  - Bug #31427410: Added a WHERE clause to I_S.USER_ATTRIBUTES

  80023: Published in 8.0.23
  ------------------------------------
  Changes from version 80022:

  - WL#12819: Affects size of I_S.KEYWORDS.WORD column length.
    Following bug was raised for the same.
    Bug#31982157 THE KEYWORD LEN IN I_S GETS UPDATED WHEN
    A KEYWORD > EXISTING MAX LEN IS ADDED

  - WL#10905: INFORMATION_SCHEMA.COLUMNS table is modified to list "INVISIBLE"
              value in EXTRA column for INVISIBLE columns.

  80024..80028: Not published.
  ----------------------------------------------------------------------------
  There are no changes from version 80023. Hence server versions 80024..80028
  uses I_S version 80023.

  80029: Published in 8.0.29
  ------------------------------------
  Changes from version 80023:

  - Bug#33781534: INFORMATION_SCHEMA.KEY_COLUMN_USAGE table is modified to
                  list invisible columns with key constraints.

  80030: Current.
  ------------------------------------
  Changes from version 80029:
  - Bug #33787300 Rename utf8_xxx collations to utf8mb3_xxx

  - WL#13784: Following INFORMATION_SCHEMA tables are modified to skip listing
              generated invisible primary key and key column when system
              variable show_gipk_in_create_table_and_information_schema = OFF,
                INFORMATION_SCHEMA.COLUMNS
                INFORMATION_SCHEMA.COLUMNS_EXTENSIONS
                INFORMATION_SCHEMA.KEY_COLUMN_USAGE
                INFORMATION_SCHEMA.STATISTICS
                INFORMATION_SCHEMA.TABLE_CONSTRAINTS
                INFORMATION_SCHEMA.TABLE_CONSTRAINTS_EXTENSIONS

  80031: Next IS version number after the previous is public.
  ------------------------------------
  Changes from version 80030:
*/

static const uint IS_DD_VERSION = 80030;
static_assert((IS_DD_VERSION <= MYSQL_VERSION_ID) ||
                  ((IS_DD_VERSION == 800201) && (MYSQL_VERSION_ID >= 80020)),
              "This release can not use a version number from the future");

/**
  Initialize INFORMATION_SCHEMA system views.

  @param thd    Thread context.

  @return       Upon failure, return true, otherwise false.
*/
bool initialize(THD *thd);

/**
  Initialize non DD based INFORMATION_SCHEMA system views.

  @param thd    Thread context.

  @return       Upon failure, return true, otherwise false.
*/
bool init_non_dd_based_system_view(THD *thd);

/**
  Create INFORMATION_SCHEMA system views.

  @param thd    Thread context.

  @return       Upon failure, return true, otherwise false.
*/
bool create_system_views(THD *thd);

/**
  Store the server I_S table metadata into dictionary, once during MySQL
  server bootstrap.

  @param thd    Thread context.

  @return       Upon failure, return true, otherwise false.
*/
bool store_server_I_S_metadata(THD *thd);

/**
  Store I_S table metadata into dictionary, during MySQL server startup.

  @param thd    Thread context.

  @return       Upon failure, return true, otherwise false.
*/
bool update_I_S_metadata(THD *thd);

/**
  Store dynamic I_S plugin table metadata into dictionary, during INSTALL
  command execution.

  @param thd         Thread context.
  @param plugin_int  I_S Plugin of which the metadata is to be stored.

  @return       Upon failure, return true, otherwise false.
*/
bool store_dynamic_plugin_I_S_metadata(THD *thd, st_plugin_int *plugin_int);

/**
  Remove I_S view metadata from dictionary. This is used
  UNINSTALL and server restart procedure when I_S version is changed.

  @param thd         Thread context.
  @param view_name   I_S view name of which the metadata is to be stored.

  @return       Upon failure, return true, otherwise false.
*/
bool remove_I_S_view_metadata(THD *thd, const dd::String_type &view_name);

/**
  Get create view definition for the given I_S system view.

  @param schema_name Schema name.
  @param view_name   I_S view name.
  @param definition  [out] The CREATE VIEW command to create system view.
                           A pointer to a preallocated string should be
                           supplied.

  @return       Upon failure, return true, otherwise false.
*/
bool get_I_S_view_definition(const dd::String_type &schema_name,
                             const dd::String_type &view_name,
                             dd::String_type *definition);

}  // namespace info_schema
}  // namespace dd

#endif  // SQL_DD_METADATA_H