Commit 0d9ac947 authored by unknown's avatar unknown

Fx for bug#7221: information_schema: errors in "key_column_usage"

parent b603cbc3
......@@ -390,11 +390,11 @@ NULL test key_1 test t1 UNIQUE
NULL test key_2 test t1 UNIQUE
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
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
NULL test PRIMARY NULL test t1 a 1 NULL NULL NULL NULL
NULL test constraint_1 NULL test t1 a 1 NULL NULL NULL NULL
NULL test key_1 NULL test t1 a 1 NULL NULL NULL NULL
NULL test key_2 NULL test t1 a 1 NULL NULL NULL NULL
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
NULL test PRIMARY NULL test t1 a 1 NULL
NULL test constraint_1 NULL test t1 a 1 NULL
NULL test key_1 NULL test t1 a 1 NULL
NULL test key_2 NULL test t1 a 1 NULL
select table_name from information_schema.TABLES where table_schema like "test%";
table_name
t1
......@@ -559,7 +559,7 @@ TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_NAME= "vo";
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
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
......
......@@ -11,9 +11,9 @@ NULL test t2_ibfk_1 test t2 FOREIGN KEY
NULL test t2_ibfk_2 test t2 FOREIGN KEY
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
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
NULL test PRIMARY NULL test t1 id 1 NULL NULL NULL NULL
NULL test PRIMARY NULL test t2 id 1 NULL NULL NULL NULL
NULL test t2_ibfk_1 NULL test t2 t1_id 1 1 test t1 id
NULL test t2_ibfk_2 NULL test t2 t1_id 1 1 test t1 id
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
NULL test PRIMARY NULL test t1 id 1 NULL
NULL test PRIMARY NULL test t2 id 1 NULL
NULL test t2_ibfk_1 NULL test t2 t1_id 1 1
NULL test t2_ibfk_2 NULL test t2 t1_id 1 1
drop table t2, t1;
......@@ -2979,14 +2979,6 @@ static int get_schema_key_column_usage_record(THD *thd,
(longlong) f_idx);
table->field[8]->store((longlong) f_idx);
table->field[8]->set_notnull();
table->field[9]->store(f_key_info->referenced_db->str,
f_key_info->referenced_db->length, cs);
table->field[9]->set_notnull();
table->field[10]->store(f_key_info->referenced_table->str,
f_key_info->referenced_table->length, cs);
table->field[10]->set_notnull();
table->field[11]->store(r_info->str, r_info->length, cs);
table->field[11]->set_notnull();
table->file->write_row(table->record[0]);
}
}
......@@ -3602,9 +3594,6 @@ ST_FIELD_INFO key_column_usage_fields_info[]=
{"COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"ORDINAL_POSITION", 10 ,MYSQL_TYPE_LONG, 0, 0, 0},
{"POSITION_IN_UNIQUE_CONSTRAINT", 10 ,MYSQL_TYPE_LONG, 0, 1, 0},
{"REFERENCED_TABLE_SCHEMA", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"REFERENCED_TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{"REFERENCED_COLUMN_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 1, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment