| 1 |
SHOW TABLES FROM information_schema LIKE 'KEY_COLUMN_USAGE'; |
| 2 |
Tables_in_information_schema (KEY_COLUMN_USAGE) |
| 3 |
KEY_COLUMN_USAGE |
| 4 |
####################################################################### |
| 5 |
# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT |
| 6 |
####################################################################### |
| 7 |
DROP VIEW IF EXISTS test.v1; |
| 8 |
DROP PROCEDURE IF EXISTS test.p1; |
| 9 |
DROP FUNCTION IF EXISTS test.f1; |
| 10 |
CREATE VIEW test.v1 AS SELECT * FROM information_schema.KEY_COLUMN_USAGE; |
| 11 |
CREATE PROCEDURE test.p1() SELECT * FROM information_schema.KEY_COLUMN_USAGE; |
| 12 |
CREATE FUNCTION test.f1() returns BIGINT |
| 13 |
BEGIN |
| 14 |
DECLARE counter BIGINT DEFAULT NULL; |
| 15 |
SELECT COUNT(*) INTO counter FROM information_schema.KEY_COLUMN_USAGE; |
| 16 |
RETURN counter; |
| 17 |
END// |
| 18 |
# Attention: The printing of the next result sets is disabled. |
| 19 |
SELECT * FROM information_schema.KEY_COLUMN_USAGE; |
| 20 |
SELECT * FROM test.v1; |
| 21 |
CALL test.p1; |
| 22 |
SELECT test.f1(); |
| 23 |
DROP VIEW test.v1; |
| 24 |
DROP PROCEDURE test.p1; |
| 25 |
DROP FUNCTION test.f1; |
| 26 |
######################################################################### |
| 27 |
# Testcase 3.2.7.1: INFORMATION_SCHEMA.KEY_COLUMN_USAGE layout |
| 28 |
######################################################################### |
| 29 |
DESCRIBE information_schema.KEY_COLUMN_USAGE; |
| 30 |
Field Type Null Key Default Extra |
| 31 |
CONSTRAINT_CATALOG varchar(512) NO NULL |
| 32 |
CONSTRAINT_SCHEMA varchar(64) NO NULL |
| 33 |
CONSTRAINT_NAME varchar(64) NO NULL |
| 34 |
TABLE_CATALOG varchar(512) NO NULL |
| 35 |
TABLE_SCHEMA varchar(64) NO NULL |
| 36 |
TABLE_NAME varchar(64) NO NULL |
| 37 |
COLUMN_NAME varchar(64) NO NULL |
| 38 |
ORDINAL_POSITION bigint(10) NO NULL |
| 39 |
POSITION_IN_UNIQUE_CONSTRAINT bigint(10) YES NULL |
| 40 |
REFERENCED_TABLE_SCHEMA varchar(64) YES NULL |
| 41 |
REFERENCED_TABLE_NAME varchar(64) YES NULL |
| 42 |
REFERENCED_COLUMN_NAME varchar(64) YES NULL |
| 43 |
SHOW CREATE TABLE information_schema.KEY_COLUMN_USAGE; |
| 44 |
Table Create Table |
| 45 |
KEY_COLUMN_USAGE CREATE TEMPORARY TABLE `KEY_COLUMN_USAGE` ( |
| 46 |
`CONSTRAINT_CATALOG` varchar(512) NOT NULL, |
| 47 |
`CONSTRAINT_SCHEMA` varchar(64) NOT NULL, |
| 48 |
`CONSTRAINT_NAME` varchar(64) NOT NULL, |
| 49 |
`TABLE_CATALOG` varchar(512) NOT NULL, |
| 50 |
`TABLE_SCHEMA` varchar(64) NOT NULL, |
| 51 |
`TABLE_NAME` varchar(64) NOT NULL, |
| 52 |
`COLUMN_NAME` varchar(64) NOT NULL, |
| 53 |
`ORDINAL_POSITION` bigint(10) NOT NULL, |
| 54 |
`POSITION_IN_UNIQUE_CONSTRAINT` bigint(10), |
| 55 |
`REFERENCED_TABLE_SCHEMA` varchar(64), |
| 56 |
`REFERENCED_TABLE_NAME` varchar(64), |
| 57 |
`REFERENCED_COLUMN_NAME` varchar(64) |
| 58 |
) ENGINE=MEMORY DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci |
| 59 |
SHOW COLUMNS FROM information_schema.KEY_COLUMN_USAGE; |
| 60 |
Field Type Null Key Default Extra |
| 61 |
CONSTRAINT_CATALOG varchar(512) NO NULL |
| 62 |
CONSTRAINT_SCHEMA varchar(64) NO NULL |
| 63 |
CONSTRAINT_NAME varchar(64) NO NULL |
| 64 |
TABLE_CATALOG varchar(512) NO NULL |
| 65 |
TABLE_SCHEMA varchar(64) NO NULL |
| 66 |
TABLE_NAME varchar(64) NO NULL |
| 67 |
COLUMN_NAME varchar(64) NO NULL |
| 68 |
ORDINAL_POSITION bigint(10) NO NULL |
| 69 |
POSITION_IN_UNIQUE_CONSTRAINT bigint(10) YES NULL |
| 70 |
REFERENCED_TABLE_SCHEMA varchar(64) YES NULL |
| 71 |
REFERENCED_TABLE_NAME varchar(64) YES NULL |
| 72 |
REFERENCED_COLUMN_NAME varchar(64) YES NULL |
| 73 |
SELECT constraint_catalog, constraint_schema, constraint_name, table_catalog, |
| 74 |
table_schema, table_name, column_name |
| 75 |
FROM information_schema.key_column_usage |
| 76 |
WHERE constraint_catalog IS NOT NULL OR table_catalog IS NOT NULL |
| 77 |
ORDER BY BINARY table_schema, BINARY table_name, BINARY column_name, BINARY constraint_name; |
| 78 |
constraint_catalog constraint_schema constraint_name table_catalog table_schema table_name column_name |
| 79 |
def mysql PRIMARY def mysql column_stats column_name |
| 80 |
def mysql PRIMARY def mysql column_stats db_name |
| 81 |
def mysql PRIMARY def mysql column_stats table_name |
| 82 |
def mysql PRIMARY def mysql columns_priv Column_name |
| 83 |
def mysql PRIMARY def mysql columns_priv Db |
| 84 |
def mysql PRIMARY def mysql columns_priv Host |
| 85 |
def mysql PRIMARY def mysql columns_priv Table_name |
| 86 |
def mysql PRIMARY def mysql columns_priv User |
| 87 |
def mysql PRIMARY def mysql db Db |
| 88 |
def mysql PRIMARY def mysql db Host |
| 89 |
def mysql PRIMARY def mysql db User |
| 90 |
def mysql PRIMARY def mysql event db |
| 91 |
def mysql PRIMARY def mysql event name |
| 92 |
def mysql PRIMARY def mysql func name |
| 93 |
def mysql PRIMARY def mysql global_priv Host |
| 94 |
def mysql PRIMARY def mysql global_priv User |
| 95 |
def mysql PRIMARY def mysql gtid_slave_pos domain_id |
| 96 |
def mysql PRIMARY def mysql gtid_slave_pos sub_id |
| 97 |
def mysql PRIMARY def mysql help_category help_category_id |
| 98 |
def mysql name def mysql help_category name |
| 99 |
def mysql PRIMARY def mysql help_keyword help_keyword_id |
| 100 |
def mysql name def mysql help_keyword name |
| 101 |
def mysql PRIMARY def mysql help_relation help_keyword_id |
| 102 |
def mysql PRIMARY def mysql help_relation help_topic_id |
| 103 |
def mysql PRIMARY def mysql help_topic help_topic_id |
| 104 |
def mysql name def mysql help_topic name |
| 105 |
def mysql PRIMARY def mysql index_stats db_name |
| 106 |
def mysql PRIMARY def mysql index_stats index_name |
| 107 |
def mysql PRIMARY def mysql index_stats prefix_arity |
| 108 |
def mysql PRIMARY def mysql index_stats table_name |
| 109 |
def mysql PRIMARY def mysql innodb_index_stats database_name |
| 110 |
def mysql PRIMARY def mysql innodb_index_stats index_name |
| 111 |
def mysql PRIMARY def mysql innodb_index_stats stat_name |
| 112 |
def mysql PRIMARY def mysql innodb_index_stats table_name |
| 113 |
def mysql PRIMARY def mysql innodb_table_stats database_name |
| 114 |
def mysql PRIMARY def mysql innodb_table_stats table_name |
| 115 |
def mysql PRIMARY def mysql plugin name |
| 116 |
def mysql PRIMARY def mysql proc db |
| 117 |
def mysql PRIMARY def mysql proc name |
| 118 |
def mysql PRIMARY def mysql proc type |
| 119 |
def mysql PRIMARY def mysql procs_priv Db |
| 120 |
def mysql PRIMARY def mysql procs_priv Host |
| 121 |
def mysql PRIMARY def mysql procs_priv Routine_name |
| 122 |
def mysql PRIMARY def mysql procs_priv Routine_type |
| 123 |
def mysql PRIMARY def mysql procs_priv User |
| 124 |
def mysql PRIMARY def mysql proxies_priv Host |
| 125 |
def mysql PRIMARY def mysql proxies_priv Proxied_host |
| 126 |
def mysql PRIMARY def mysql proxies_priv Proxied_user |
| 127 |
def mysql PRIMARY def mysql proxies_priv User |
| 128 |
def mysql Host def mysql roles_mapping Host |
| 129 |
def mysql Host def mysql roles_mapping Role |
| 130 |
def mysql Host def mysql roles_mapping User |
| 131 |
def mysql PRIMARY def mysql servers Server_name |
| 132 |
def mysql PRIMARY def mysql table_stats db_name |
| 133 |
def mysql PRIMARY def mysql table_stats table_name |
| 134 |
def mysql PRIMARY def mysql tables_priv Db |
| 135 |
def mysql PRIMARY def mysql tables_priv Host |
| 136 |
def mysql PRIMARY def mysql tables_priv Table_name |
| 137 |
def mysql PRIMARY def mysql tables_priv User |
| 138 |
def mysql PRIMARY def mysql time_zone Time_zone_id |
| 139 |
def mysql PRIMARY def mysql time_zone_leap_second Transition_time |
| 140 |
def mysql PRIMARY def mysql time_zone_name Name |
| 141 |
def mysql PRIMARY def mysql time_zone_transition Time_zone_id |
| 142 |
def mysql PRIMARY def mysql time_zone_transition Transition_time |
| 143 |
def mysql PRIMARY def mysql time_zone_transition_type Time_zone_id |
| 144 |
def mysql PRIMARY def mysql time_zone_transition_type Transition_type_id |
| 145 |
def mysql commit_id def mysql transaction_registry commit_id |
| 146 |
def mysql PRIMARY def mysql transaction_registry transaction_id |
| 147 |
def sys PRIMARY def sys sys_config variable |
| 148 |
######################################################################################## |
| 149 |
# Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.KEY_COLUMN_USAGE accessible information |
| 150 |
######################################################################################## |
| 151 |
DROP DATABASE IF EXISTS db_datadict; |
| 152 |
CREATE DATABASE db_datadict; |
| 153 |
DROP USER 'testuser1'@'localhost'; |
| 154 |
CREATE USER 'testuser1'@'localhost'; |
| 155 |
DROP USER 'testuser2'@'localhost'; |
| 156 |
CREATE USER 'testuser2'@'localhost'; |
| 157 |
USE db_datadict; |
| 158 |
CREATE TABLE t1_1 |
| 159 |
(f1 INT NOT NULL, PRIMARY KEY(f1), |
| 160 |
f2 INT, INDEX f2_ind(f2)) |
| 161 |
ENGINE = <engine_type>; |
| 162 |
GRANT SELECT ON t1_1 to 'testuser1'@'localhost'; |
| 163 |
CREATE TABLE t1_2 |
| 164 |
(f1 INT NOT NULL, PRIMARY KEY(f1), |
| 165 |
f2 INT, INDEX f2_ind(f2)) |
| 166 |
ENGINE = <engine_type>; |
| 167 |
GRANT SELECT ON t1_2 to 'testuser2'@'localhost'; |
| 168 |
SELECT * FROM information_schema.key_column_usage |
| 169 |
WHERE table_name LIKE 't1_%' |
| 170 |
ORDER BY constraint_catalog, constraint_schema, constraint_name, |
| 171 |
table_catalog, table_schema, table_name, ordinal_position; |
| 172 |
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME |
| 173 |
def db_datadict PRIMARY def db_datadict t1_1 f1 1 NULL NULL NULL NULL |
| 174 |
def db_datadict PRIMARY def db_datadict t1_2 f1 1 NULL NULL NULL NULL |
| 175 |
connect testuser1, localhost, testuser1, , db_datadict; |
| 176 |
SELECT * FROM information_schema.key_column_usage |
| 177 |
WHERE table_name LIKE 't1_%' |
| 178 |
ORDER BY constraint_catalog, constraint_schema, constraint_name, |
| 179 |
table_catalog, table_schema, table_name, ordinal_position; |
| 180 |
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME |
| 181 |
def db_datadict PRIMARY def db_datadict t1_1 f1 1 NULL NULL NULL NULL |
| 182 |
connect testuser2, localhost, testuser2, , db_datadict; |
| 183 |
SELECT * FROM information_schema.key_column_usage |
| 184 |
WHERE table_name LIKE 't1_%' |
| 185 |
ORDER BY constraint_catalog, constraint_schema, constraint_name, |
| 186 |
table_catalog, table_schema, table_name, ordinal_position; |
| 187 |
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME |
| 188 |
def db_datadict PRIMARY def db_datadict t1_2 f1 1 NULL NULL NULL NULL |
| 189 |
connection default; |
| 190 |
disconnect testuser1; |
| 191 |
disconnect testuser2; |
| 192 |
DROP USER 'testuser1'@'localhost'; |
| 193 |
DROP USER 'testuser2'@'localhost'; |
| 194 |
DROP TABLE t1_1; |
| 195 |
DROP TABLE t1_2; |
| 196 |
DROP DATABASE IF EXISTS db_datadict; |
| 197 |
######################################################################################## |
| 198 |
# Testcase 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.KEY_COLUMN_USAGE modifications |
| 199 |
######################################################################################## |
| 200 |
DROP DATABASE IF EXISTS db_datadict; |
| 201 |
DROP TABLE IF EXISTS test.t1_my_table; |
| 202 |
CREATE DATABASE db_datadict; |
| 203 |
SELECT table_name FROM information_schema.key_column_usage |
| 204 |
WHERE table_name LIKE 't1_my_table%'; |
| 205 |
table_name |
| 206 |
CREATE TABLE test.t1_my_table |
| 207 |
(f1 CHAR(12), f2 TIMESTAMP, f4 BIGINT, PRIMARY KEY(f1,f2)) |
| 208 |
DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci |
| 209 |
ENGINE = <engine_type>; |
| 210 |
SELECT * FROM information_schema.key_column_usage |
| 211 |
WHERE table_name = 't1_my_table'; |
| 212 |
CONSTRAINT_CATALOG def |
| 213 |
CONSTRAINT_SCHEMA test |
| 214 |
CONSTRAINT_NAME PRIMARY |
| 215 |
TABLE_CATALOG def |
| 216 |
TABLE_SCHEMA test |
| 217 |
TABLE_NAME t1_my_table |
| 218 |
COLUMN_NAME f1 |
| 219 |
ORDINAL_POSITION 1 |
| 220 |
POSITION_IN_UNIQUE_CONSTRAINT NULL |
| 221 |
REFERENCED_TABLE_SCHEMA NULL |
| 222 |
REFERENCED_TABLE_NAME NULL |
| 223 |
REFERENCED_COLUMN_NAME NULL |
| 224 |
CONSTRAINT_CATALOG def |
| 225 |
CONSTRAINT_SCHEMA test |
| 226 |
CONSTRAINT_NAME PRIMARY |
| 227 |
TABLE_CATALOG def |
| 228 |
TABLE_SCHEMA test |
| 229 |
TABLE_NAME t1_my_table |
| 230 |
COLUMN_NAME f2 |
| 231 |
ORDINAL_POSITION 2 |
| 232 |
POSITION_IN_UNIQUE_CONSTRAINT NULL |
| 233 |
REFERENCED_TABLE_SCHEMA NULL |
| 234 |
REFERENCED_TABLE_NAME NULL |
| 235 |
REFERENCED_COLUMN_NAME NULL |
| 236 |
SELECT DISTINCT table_name FROM information_schema.key_column_usage |
| 237 |
WHERE table_name LIKE 't1_my_table%'; |
| 238 |
table_name |
| 239 |
t1_my_table |
| 240 |
RENAME TABLE test.t1_my_table TO test.t1_my_tablex; |
| 241 |
SELECT DISTINCT table_name FROM information_schema.key_column_usage |
| 242 |
WHERE table_name LIKE 't1_my_table%'; |
| 243 |
table_name |
| 244 |
t1_my_tablex |
| 245 |
SELECT DISTINCT table_schema,table_name FROM information_schema.key_column_usage |
| 246 |
WHERE table_name = 't1_my_tablex'; |
| 247 |
table_schema table_name |
| 248 |
test t1_my_tablex |
| 249 |
RENAME TABLE test.t1_my_tablex TO db_datadict.t1_my_tablex; |
| 250 |
SELECT DISTINCT table_schema,table_name FROM information_schema.key_column_usage |
| 251 |
WHERE table_name = 't1_my_tablex'; |
| 252 |
table_schema table_name |
| 253 |
db_datadict t1_my_tablex |
| 254 |
SELECT DISTINCT table_name, column_name FROM information_schema.key_column_usage |
| 255 |
WHERE table_name = 't1_my_tablex' |
| 256 |
ORDER BY table_name, column_name; |
| 257 |
table_name column_name |
| 258 |
t1_my_tablex f1 |
| 259 |
t1_my_tablex f2 |
| 260 |
ALTER TABLE db_datadict.t1_my_tablex CHANGE COLUMN f1 first_col CHAR(12); |
| 261 |
SELECT DISTINCT table_name, column_name FROM information_schema.key_column_usage |
| 262 |
WHERE table_name = 't1_my_tablex' |
| 263 |
ORDER BY table_name, column_name; |
| 264 |
table_name column_name |
| 265 |
t1_my_tablex f2 |
| 266 |
t1_my_tablex first_col |
| 267 |
SELECT constraint_schema, constraint_name, table_schema, |
| 268 |
table_name, column_name, ordinal_position |
| 269 |
FROM information_schema.key_column_usage |
| 270 |
WHERE table_name = 't1_my_tablex' |
| 271 |
ORDER BY constraint_schema, constraint_name, table_schema, |
| 272 |
table_name, ordinal_position; |
| 273 |
constraint_schema constraint_name table_schema table_name column_name ordinal_position |
| 274 |
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 |
| 275 |
db_datadict PRIMARY db_datadict t1_my_tablex f2 2 |
| 276 |
CREATE INDEX f2 ON db_datadict.t1_my_tablex(f2); |
| 277 |
SELECT constraint_schema, constraint_name, table_schema, |
| 278 |
table_name, column_name, ordinal_position |
| 279 |
FROM information_schema.key_column_usage |
| 280 |
WHERE table_name = 't1_my_tablex' |
| 281 |
ORDER BY constraint_schema, constraint_name, table_schema, |
| 282 |
table_name, ordinal_position; |
| 283 |
constraint_schema constraint_name table_schema table_name column_name ordinal_position |
| 284 |
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 |
| 285 |
db_datadict PRIMARY db_datadict t1_my_tablex f2 2 |
| 286 |
DROP INDEX f2 ON db_datadict.t1_my_tablex; |
| 287 |
SELECT constraint_schema, constraint_name, table_schema, |
| 288 |
table_name, column_name, ordinal_position |
| 289 |
FROM information_schema.key_column_usage |
| 290 |
WHERE table_name = 't1_my_tablex' |
| 291 |
ORDER BY constraint_schema, constraint_name, table_schema, |
| 292 |
table_name, ordinal_position; |
| 293 |
constraint_schema constraint_name table_schema table_name column_name ordinal_position |
| 294 |
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 |
| 295 |
db_datadict PRIMARY db_datadict t1_my_tablex f2 2 |
| 296 |
ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE (f2); |
| 297 |
SELECT constraint_schema, constraint_name, table_schema, |
| 298 |
table_name, column_name, ordinal_position |
| 299 |
FROM information_schema.key_column_usage |
| 300 |
WHERE table_name = 't1_my_tablex' |
| 301 |
ORDER BY constraint_schema, constraint_name, table_schema, |
| 302 |
table_name, ordinal_position; |
| 303 |
constraint_schema constraint_name table_schema table_name column_name ordinal_position |
| 304 |
db_datadict f2 db_datadict t1_my_tablex f2 1 |
| 305 |
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 |
| 306 |
db_datadict PRIMARY db_datadict t1_my_tablex f2 2 |
| 307 |
DROP INDEX f2 ON db_datadict.t1_my_tablex; |
| 308 |
SELECT constraint_schema, constraint_name, table_schema, |
| 309 |
table_name, column_name, ordinal_position |
| 310 |
FROM information_schema.key_column_usage |
| 311 |
WHERE table_name = 't1_my_tablex' |
| 312 |
ORDER BY constraint_schema, constraint_name, table_schema, |
| 313 |
table_name, ordinal_position; |
| 314 |
constraint_schema constraint_name table_schema table_name column_name ordinal_position |
| 315 |
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 |
| 316 |
db_datadict PRIMARY db_datadict t1_my_tablex f2 2 |
| 317 |
ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE my_idx (f2); |
| 318 |
SELECT constraint_schema, constraint_name, table_schema, |
| 319 |
table_name, column_name, ordinal_position |
| 320 |
FROM information_schema.key_column_usage |
| 321 |
WHERE table_name = 't1_my_tablex' |
| 322 |
ORDER BY constraint_schema, constraint_name, table_schema, |
| 323 |
table_name, ordinal_position; |
| 324 |
constraint_schema constraint_name table_schema table_name column_name ordinal_position |
| 325 |
db_datadict my_idx db_datadict t1_my_tablex f2 1 |
| 326 |
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 |
| 327 |
db_datadict PRIMARY db_datadict t1_my_tablex f2 2 |
| 328 |
DROP INDEX my_idx ON db_datadict.t1_my_tablex; |
| 329 |
SELECT constraint_schema, constraint_name, table_schema, |
| 330 |
table_name, column_name, ordinal_position |
| 331 |
FROM information_schema.key_column_usage |
| 332 |
WHERE table_name = 't1_my_tablex' |
| 333 |
ORDER BY constraint_schema, constraint_name, table_schema, |
| 334 |
table_name, ordinal_position; |
| 335 |
constraint_schema constraint_name table_schema table_name column_name ordinal_position |
| 336 |
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 |
| 337 |
db_datadict PRIMARY db_datadict t1_my_tablex f2 2 |
| 338 |
ALTER TABLE db_datadict.t1_my_tablex ADD UNIQUE my_idx (f4,first_col); |
| 339 |
SELECT constraint_schema, constraint_name, table_schema, |
| 340 |
table_name, column_name, ordinal_position |
| 341 |
FROM information_schema.key_column_usage |
| 342 |
WHERE table_name = 't1_my_tablex' |
| 343 |
ORDER BY constraint_schema, constraint_name, table_schema, |
| 344 |
table_name, ordinal_position; |
| 345 |
constraint_schema constraint_name table_schema table_name column_name ordinal_position |
| 346 |
db_datadict my_idx db_datadict t1_my_tablex f4 1 |
| 347 |
db_datadict my_idx db_datadict t1_my_tablex first_col 2 |
| 348 |
db_datadict PRIMARY db_datadict t1_my_tablex first_col 1 |
| 349 |
db_datadict PRIMARY db_datadict t1_my_tablex f2 2 |
| 350 |
SELECT table_name, column_name |
| 351 |
FROM information_schema.key_column_usage |
| 352 |
WHERE table_name = 't1_my_tablex' |
| 353 |
ORDER BY table_name, column_name; |
| 354 |
table_name column_name |
| 355 |
t1_my_tablex f2 |
| 356 |
t1_my_tablex f4 |
| 357 |
t1_my_tablex first_col |
| 358 |
t1_my_tablex first_col |
| 359 |
DROP TABLE db_datadict.t1_my_tablex; |
| 360 |
SELECT table_name, column_name |
| 361 |
FROM information_schema.key_column_usage |
| 362 |
WHERE table_name = 't1_my_tablex'; |
| 363 |
table_name column_name |
| 364 |
SELECT table_name FROM information_schema.key_column_usage |
| 365 |
WHERE table_name = 't1_my_tablex'; |
| 366 |
table_name |
| 367 |
CREATE TABLE db_datadict.t1_my_tablex |
| 368 |
ENGINE = <engine_type> AS |
| 369 |
SELECT 1 AS f1; |
| 370 |
SELECT table_name FROM information_schema.key_column_usage |
| 371 |
WHERE table_name = 't1_my_tablex'; |
| 372 |
table_name |
| 373 |
ALTER TABLE db_datadict.t1_my_tablex ADD PRIMARY KEY(f1); |
| 374 |
SELECT table_name FROM information_schema.key_column_usage |
| 375 |
WHERE table_name = 't1_my_tablex'; |
| 376 |
table_name |
| 377 |
t1_my_tablex |
| 378 |
SELECT table_name FROM information_schema.key_column_usage |
| 379 |
WHERE table_name = 't1_my_tablex'; |
| 380 |
table_name |
| 381 |
t1_my_tablex |
| 382 |
DROP DATABASE db_datadict; |
| 383 |
SELECT table_name FROM information_schema.key_column_usage |
| 384 |
WHERE table_name = 't1_my_tablex'; |
| 385 |
table_name |
| 386 |
######################################################################## |
| 387 |
# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and |
| 388 |
# DDL on INFORMATION_SCHEMA table are not supported |
| 389 |
######################################################################## |
| 390 |
DROP DATABASE IF EXISTS db_datadict; |
| 391 |
DROP TABLE IF EXISTS db_datadict.t1; |
| 392 |
CREATE DATABASE db_datadict; |
| 393 |
CREATE TABLE db_datadict.t1 (f1 BIGINT) |
| 394 |
ENGINE = <engine_type>; |
| 395 |
INSERT INTO information_schema.key_column_usage |
| 396 |
(constraint_schema, constraint_name, table_name) |
| 397 |
VALUES ( 'mysql', 'primary', 'db'); |
| 398 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 399 |
INSERT INTO information_schema.key_column_usage |
| 400 |
SELECT * FROM information_schema.key_column_usage; |
| 401 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 402 |
UPDATE information_schema.key_column_usage |
| 403 |
SET table_name = 'db1' WHERE constraint_name = 'primary'; |
| 404 |
Got one of the listed errors |
| 405 |
DELETE FROM information_schema.key_column_usage WHERE table_name = 't1'; |
| 406 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 407 |
TRUNCATE information_schema.key_column_usage; |
| 408 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 409 |
CREATE INDEX i3 ON information_schema.key_column_usage(table_name); |
| 410 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 411 |
ALTER TABLE information_schema.key_column_usage ADD f1 INT; |
| 412 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 413 |
DROP TABLE information_schema.key_column_usage; |
| 414 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 415 |
ALTER TABLE information_schema.key_column_usage |
| 416 |
RENAME db_datadict.key_column_usage; |
| 417 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 418 |
ALTER TABLE information_schema.key_column_usage |
| 419 |
RENAME information_schema.xkey_column_usage; |
| 420 |
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' |
| 421 |
DROP TABLE db_datadict.t1; |
| 422 |
DROP DATABASE db_datadict; |