=== modified file 'ChangeLog' --- ChangeLog 2010-01-08 20:03:20 +0000 +++ ChangeLog 2010-02-19 22:34:24 +0000 @@ -6,6 +6,9 @@ Bugs fixed: * If NO_BACKSLASH_ESCAPES mode is used on a server, escaping binary data can lead to server query parsing errors. (Bug #49029) + * If there are foreign key constraints with same name for tables with same + names in 2 schemas, SQLForeignKeys can return rows for both + schemas in query about one of those tables. (Bug #49660) ---- === modified file 'driver/catalog.c' --- driver/catalog.c 2010-01-31 00:29:06 +0000 +++ driver/catalog.c 2010-02-19 22:18:18 +0000 @@ -1759,7 +1759,7 @@ "7 AS DEFERRABILITY" " FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE A" " JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS B" - " USING (CONSTRAINT_NAME,TABLE_NAME)", + " USING (CONSTRAINT_SCHEMA,CONSTRAINT_NAME,TABLE_NAME)", ref_constraints_join, " WHERE B.CONSTRAINT_TYPE = 'FOREIGN KEY' ", NullS); === modified file 'test/my_catalog.c' --- test/my_catalog.c 2010-01-31 00:29:06 +0000 +++ test/my_catalog.c 2010-02-19 22:37:29 +0000 @@ -1443,6 +1443,36 @@ } +DECLARE_TEST(t_bug49660) +{ + SQLLEN rowsCount; + + ok_sql(hstmt, "drop database if exists bug49660"); + ok_sql(hstmt, "drop table if exists t_bug49660"); + ok_sql(hstmt, "drop table if exists t_bug49660_r"); + + ok_sql(hstmt, "create database bug49660"); + ok_sql(hstmt, "create table bug49660.t_bug49660_r (id int unsigned not null primary key, name varchar(10) not null)"); + ok_sql(hstmt, "create table bug49660.t_bug49660 (id int unsigned not null primary key, refid int unsigned not null," + "foreign key t_bug49660fk (id) references bug49660.t_bug49660_r (id))"); + + ok_sql(hstmt, "create table t_bug49660_r (id int unsigned not null primary key, name varchar(10) not null)"); + ok_sql(hstmt, "create table t_bug49660 (id int unsigned not null primary key, refid int unsigned not null," + "foreign key t_bug49660fk (id) references t_bug49660_r (id))"); + + ok_stmt(hstmt, SQLForeignKeys(hstmt, NULL, 0, NULL, 0, NULL, 0, NULL, 0, + NULL, 0, (SQLCHAR *)"t_bug49660", SQL_NTS)); + + ok_stmt(hstmt, SQLRowCount(hstmt, &rowsCount)); + is_num(rowsCount, 1); + + ok_sql(hstmt, "drop database if exists bug49660"); + ok_sql(hstmt, "drop table if exists t_bug49660"); + ok_sql(hstmt, "drop table if exists t_bug49660_r"); + + return OK; +} + BEGIN_TESTS ADD_TEST(my_columns_null) ADD_TEST(my_drop_table) @@ -1473,6 +1503,7 @@ ADD_TEST(t_bug30770) ADD_TEST(t_bug36275) ADD_TEST(t_bug39957) + ADD_TEST(t_bug49660) END_TESTS