From 6a528590d9e9e513cf94bb82b3d05f6281c73d77 Mon Sep 17 00:00:00 2001 From: "timour@mysql.com" <> Date: Mon, 12 Sep 2005 08:28:53 +0300 Subject: [PATCH] Fix for BUG#13067 "JOIN ... USING is case sensitive". --- mysql-test/r/select.result | 10 ++++++++++ mysql-test/t/select.test | 12 ++++++++++++ sql/sql_base.cc | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 24c89039566..5f2f5f50a16 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2912,3 +2912,13 @@ ERROR 23000: Column 'id' in from clause is ambiguous SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id); ERROR 23000: Column 'id' in from clause is ambiguous drop table t1, t2, t3; +create table t1 (a int(10),b int(10)); +create table t2 (a int(10),b int(10)); +insert into t1 values (1,10),(2,20),(3,30); +insert into t2 values (1,10); +select * from t1 inner join t2 using (A); +a b b +1 10 10 +select * from t1 inner join t2 using (a); +a b b +1 10 10 diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 62687a869b7..c4b50a7556b 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2487,3 +2487,15 @@ SELECT id,t3.id FROM t1 JOIN t2 ON (t2.id=t1.id) LEFT JOIN t3 USING (id); SELECT id,t3.id FROM (t1 JOIN t2 ON (t2.id=t1.id)) LEFT JOIN t3 USING (id); drop table t1, t2, t3; + +# +# Bug #13067 JOIN xxx USING is case sensitive +# + +create table t1 (a int(10),b int(10)); +create table t2 (a int(10),b int(10)); +insert into t1 values (1,10),(2,20),(3,30); +insert into t2 values (1,10); +# both queries should produce the same result +select * from t1 inner join t2 using (A); +select * from t1 inner join t2 using (a); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 8a5c5643ce2..766840e667c 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3414,7 +3414,7 @@ test_if_string_in_list(const char *find, List *str_list) { if (find_length != curr_str->length()) continue; - if (!strncmp(find, curr_str->ptr(), find_length)) + if (!my_strcasecmp(system_charset_info, find, curr_str->ptr())) return TRUE; } return FALSE;