Below is the list of changes that have just been committed into a local
5.1 repository of gluh. When gluh does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-01-15 13:39:28+04:00, gluh@stripped +5 -0
Bug#21713 incorrect value for the REFERENTIAL_CONSTRAINTS.UNIQUE_CONSTRAINT_NAME column
added new field 'REFERENCED_TABLE_NAME' to 'referential_constraints' table
field 'UNIQUE_CONSTRAINT_NAME' contains the name of the referenced index
mysql-test/r/information_schema_inno.result@stripped, 2007-01-15 13:39:26+04:00, gluh@stripped +8 -8
result fix
mysql-test/t/information_schema_inno.test@stripped, 2007-01-15 13:39:26+04:00, gluh@stripped +3 -4
test fix
sql/sql_show.cc@stripped, 2007-01-15 13:39:27+04:00, gluh@stripped +4 -1
added new field 'REFERENCED_TABLE_NAME' to 'referential_constraints' table
field 'UNIQUE_CONSTRAINT_NAME' contains the name of the referenced index
sql/table.h@stripped, 2007-01-15 13:39:27+04:00, gluh@stripped +1 -0
added 'referenced_key_name' member to 'st_foreign_key_info' struct
storage/innobase/handler/ha_innodb.cc@stripped, 2007-01-15 13:39:27+04:00, gluh@stripped +8 -2
added the filling of referenced key name
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: gluh
# Host: eagle.(none)
# Root: /home/gluh/MySQL/Merge/5.1-opt
--- 1.382/sql/sql_show.cc 2006-12-27 13:58:01 +04:00
+++ 1.383/sql/sql_show.cc 2007-01-15 13:39:27 +04:00
@@ -4497,8 +4497,10 @@ get_referential_constraints_record(THD *
f_key_info->forein_id->length, cs);
table->field[4]->store(f_key_info->referenced_db->str,
f_key_info->referenced_db->length, cs);
- table->field[5]->store(f_key_info->referenced_table->str,
+ table->field[10]->store(f_key_info->referenced_table->str,
f_key_info->referenced_table->length, cs);
+ table->field[5]->store(f_key_info->referenced_key_name->str,
+ f_key_info->referenced_key_name->length, cs);
table->field[6]->store(STRING_WITH_LEN("NONE"), cs);
table->field[7]->store(f_key_info->update_method->str,
f_key_info->update_method->length, cs);
@@ -5668,6 +5670,7 @@ ST_FIELD_INFO referential_constraints_fi
{"UPDATE_RULE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"DELETE_RULE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{"TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+ {"REFERENCED_TABLE_NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
{0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};
--- 1.157/sql/table.h 2006-12-31 04:06:37 +04:00
+++ 1.158/sql/table.h 2007-01-15 13:39:27 +04:00
@@ -460,6 +460,7 @@ typedef struct st_foreign_key_info
LEX_STRING *referenced_table;
LEX_STRING *update_method;
LEX_STRING *delete_method;
+ LEX_STRING *referenced_key_name;
List<LEX_STRING> foreign_fields;
List<LEX_STRING> referenced_fields;
} FOREIGN_KEY_INFO;
--- 1.10/mysql-test/r/information_schema_inno.result 2007-01-09 18:14:02 +04:00
+++ 1.11/mysql-test/r/information_schema_inno.result 2007-01-15 13:39:26 +04:00
@@ -31,11 +31,11 @@ CREATE TABLE t2(b1 INT, b2 INT, INDEX (b
CONSTRAINT A1
FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
-CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2),
+CREATE TABLE t3(b1 INT, b2 INT, INDEX t3_indx (b1, b2),
CONSTRAINT A2
FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
-CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2),
+CREATE TABLE t4(b1 INT, b2 INT, UNIQUE KEY t4_ukey (b1, b2),
CONSTRAINT A3
FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
@@ -45,16 +45,16 @@ FOREIGN KEY (b1, b2) REFERENCES t4(b1, b
ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
-MATCH_OPTION, UPDATE_RULE, DELETE_RULE
+MATCH_OPTION, UPDATE_RULE, DELETE_RULE, b.REFERENCED_TABLE_NAME
from information_schema.TABLE_CONSTRAINTS a,
information_schema.REFERENTIAL_CONSTRAINTS b
where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
a.CONSTRAINT_NAME = b.CONSTRAINT_NAME;
-CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_TYPE CONSTRAINT_NAME UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE
-test t2 FOREIGN KEY A1 test t1 NONE CASCADE NO ACTION
-test t3 FOREIGN KEY A2 test t2 NONE SET NULL RESTRICT
-test t4 FOREIGN KEY A3 test t3 NONE NO ACTION SET NULL
-test t5 FOREIGN KEY A4 test t4 NONE RESTRICT CASCADE
+CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_TYPE CONSTRAINT_NAME UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE REFERENCED_TABLE_NAME
+test t2 FOREIGN KEY A1 test PRIMARY NONE CASCADE NO ACTION t1
+test t3 FOREIGN KEY A2 test b1 NONE SET NULL RESTRICT t2
+test t4 FOREIGN KEY A3 test t3_indx NONE NO ACTION SET NULL t3
+test t5 FOREIGN KEY A4 test t4_ukey NONE RESTRICT CASCADE t4
drop tables t5, t4, t3, t2, t1;
create database `db-1`;
use `db-1`;
--- 1.7/mysql-test/t/information_schema_inno.test 2007-01-09 18:14:02 +04:00
+++ 1.8/mysql-test/t/information_schema_inno.test 2007-01-15 13:39:26 +04:00
@@ -32,11 +32,11 @@ CREATE TABLE t2(b1 INT, b2 INT, INDEX (b
CONSTRAINT A1
FOREIGN KEY (b1, b2) REFERENCES t1(a1, a2)
ON UPDATE CASCADE ON DELETE NO ACTION) ENGINE=INNODB;
-CREATE TABLE t3(b1 INT, b2 INT, INDEX (b1, b2),
+CREATE TABLE t3(b1 INT, b2 INT, INDEX t3_indx (b1, b2),
CONSTRAINT A2
FOREIGN KEY (b1, b2) REFERENCES t2(b1, b2)
ON UPDATE SET NULL ON DELETE RESTRICT) ENGINE=INNODB;
-CREATE TABLE t4(b1 INT, b2 INT, INDEX (b1, b2),
+CREATE TABLE t4(b1 INT, b2 INT, UNIQUE KEY t4_ukey (b1, b2),
CONSTRAINT A3
FOREIGN KEY (b1, b2) REFERENCES t3(b1, b2)
ON UPDATE NO ACTION ON DELETE SET NULL) ENGINE=INNODB;
@@ -45,10 +45,9 @@ CREATE TABLE t5(b1 INT, b2 INT, INDEX (b
FOREIGN KEY (b1, b2) REFERENCES t4(b1, b2)
ON UPDATE RESTRICT ON DELETE CASCADE) ENGINE=INNODB;
-
select a.CONSTRAINT_SCHEMA, b.TABLE_NAME, CONSTRAINT_TYPE,
b.CONSTRAINT_NAME, UNIQUE_CONSTRAINT_SCHEMA, UNIQUE_CONSTRAINT_NAME,
- MATCH_OPTION, UPDATE_RULE, DELETE_RULE
+ MATCH_OPTION, UPDATE_RULE, DELETE_RULE, b.REFERENCED_TABLE_NAME
from information_schema.TABLE_CONSTRAINTS a,
information_schema.REFERENTIAL_CONSTRAINTS b
where a.CONSTRAINT_SCHEMA = 'test' and a.CONSTRAINT_SCHEMA = b.CONSTRAINT_SCHEMA and
--- 1.319/storage/innobase/handler/ha_innodb.cc 2007-01-12 14:47:08 +04:00
+++ 1.320/storage/innobase/handler/ha_innodb.cc 2007-01-15 13:39:27 +04:00
@@ -6003,8 +6003,14 @@ ha_innobase::get_foreign_key_list(THD *t
}
f_key_info.update_method= make_lex_string(thd, f_key_info.update_method,
tmp_buff, length, 1);
-
-
+ if (foreign->referenced_index &&
+ foreign->referenced_index->name)
+ {
+ f_key_info.referenced_key_name=
+ make_lex_string(thd, f_key_info.referenced_key_name,
+ foreign->referenced_index->name,
+ strlen(foreign->referenced_index->name), 1);
+ }
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
thd->memdup((gptr) &f_key_info,
Thread |
---|
• bk commit into 5.1 tree (gluh:1.2391) BUG#21713 | gluh | 15 Jan |