Commit d3031366 authored by paul@ice.snake.net's avatar paul@ice.snake.net

Merge paul@bk-internal.mysql.com:/home/bk/mysql-4.1

into ice.snake.net:/Volumes/ice2/MySQL/bk/mysql-4.1
parents 7b45773f 6158c94b
drop table if exists t1,t2,t3,t4,T1; drop table if exists t1,t2,t3,t4;
create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
create table t4 (id int primary key, Word varchar(40) not null); create table t4 (id int primary key, Word varchar(40) not null);
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
...@@ -49,3 +49,12 @@ delete P1.*,p2.* from t1 as P1, t2 as P2 where P1.a=p2.a; ...@@ -49,3 +49,12 @@ delete P1.*,p2.* from t1 as P1, t2 as P2 where P1.a=p2.a;
update t1 as p1, t2 as p2 SET p1.a=1,P2.a=1 where p1.a=P2.a; update t1 as p1, t2 as p2 SET p1.a=1,P2.a=1 where p1.a=P2.a;
update t1 as P1, t2 as P2 SET P1.a=1,p2.a=1 where P1.a=p2.a; update t1 as P1, t2 as P2 SET P1.a=1,p2.a=1 where P1.a=p2.a;
drop table t1,t2; drop table t1,t2;
create table t1 (a int);
create table t2 (a int);
select * from t1 c, t2 C;
ERROR 42000: Not unique table/alias: 'C'
select C.a, c.a from t1 c, t2 C;
ERROR 42000: Not unique table/alias: 'C'
drop table t1, t2;
show tables;
Tables_in_test
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# #
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3,t4,T1; drop table if exists t1,t2,t3,t4;
--enable_warnings --enable_warnings
create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
...@@ -41,3 +41,16 @@ delete P1.*,p2.* from t1 as P1, t2 as P2 where P1.a=p2.a; ...@@ -41,3 +41,16 @@ delete P1.*,p2.* from t1 as P1, t2 as P2 where P1.a=p2.a;
update t1 as p1, t2 as p2 SET p1.a=1,P2.a=1 where p1.a=P2.a; update t1 as p1, t2 as p2 SET p1.a=1,P2.a=1 where p1.a=P2.a;
update t1 as P1, t2 as P2 SET P1.a=1,p2.a=1 where P1.a=p2.a; update t1 as P1, t2 as P2 SET P1.a=1,p2.a=1 where P1.a=p2.a;
drop table t1,t2; drop table t1,t2;
#
# aliases case insensitive
#
create table t1 (a int);
create table t2 (a int);
-- error 1066
select * from t1 c, t2 C;
-- error 1066
select C.a, c.a from t1 c, t2 C;
drop table t1, t2;
show tables;
...@@ -456,8 +456,7 @@ bool Item_field::eq(const Item *item, bool binary_cmp) const ...@@ -456,8 +456,7 @@ bool Item_field::eq(const Item *item, bool binary_cmp) const
(!my_strcasecmp(table_alias_charset, item_field->table_name, (!my_strcasecmp(table_alias_charset, item_field->table_name,
table_name) && table_name) &&
(!item_field->db_name || (!item_field->db_name ||
(item_field->db_name && !my_strcasecmp(table_alias_charset, (item_field->db_name && !strcmp(item_field->db_name,
item_field->db_name,
db_name)))))); db_name))))));
} }
......
...@@ -141,7 +141,7 @@ public: ...@@ -141,7 +141,7 @@ public:
sys_update_func update_func_arg, sys_update_func update_func_arg,
sys_set_default_func set_default_func_arg, sys_set_default_func set_default_func_arg,
char *value_arg) char *value_arg)
:sys_var(name_arg), check_func(check_func_arg), value(value_arg), :sys_var(name_arg), value(value_arg), check_func(check_func_arg),
update_func(update_func_arg),set_default_func(set_default_func_arg) update_func(update_func_arg),set_default_func(set_default_func_arg)
{} {}
bool check(THD *thd, set_var *var); bool check(THD *thd, set_var *var);
......
...@@ -1259,12 +1259,7 @@ void Query_cache::invalidate(char *db) ...@@ -1259,12 +1259,7 @@ void Query_cache::invalidate(char *db)
do do
{ {
next= curr->next; next= curr->next;
/* if (strcmp(db, (char*)(curr->table()->db())) == 0)
table_alias_charset used here because it depends of
lower_case_table_names variable
*/
if (my_strcasecmp(table_alias_charset, db,
(char*)(curr->table()->db())) == 0)
invalidate_table(curr); invalidate_table(curr);
/* /*
invalidate_table can freed block on which point 'next' (if invalidate_table can freed block on which point 'next' (if
......
...@@ -504,7 +504,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, ...@@ -504,7 +504,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
found_other_files++; found_other_files++;
continue; continue;
} }
if (db && !my_strcasecmp(&my_charset_latin1, // just for safety we use files_charset_info
if (db && !my_strcasecmp(files_charset_info,
extension, reg_ext)) extension, reg_ext))
{ {
/* Drop the table nicely */ /* Drop the table nicely */
......
...@@ -2712,7 +2712,7 @@ mysql_execute_command(THD *thd) ...@@ -2712,7 +2712,7 @@ mysql_execute_command(THD *thd)
for (walk= (TABLE_LIST*) tables; walk; walk= walk->next) for (walk= (TABLE_LIST*) tables; walk; walk= walk->next)
{ {
if (!my_strcasecmp(table_alias_charset, auxi->alias, walk->alias) && if (!my_strcasecmp(table_alias_charset, auxi->alias, walk->alias) &&
!my_strcasecmp(table_alias_charset, walk->db, auxi->db)) !strcmp(walk->db, auxi->db))
break; break;
} }
if (!walk) if (!walk)
...@@ -4495,7 +4495,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd, ...@@ -4495,7 +4495,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
tables ; tables ;
tables=tables->next) tables=tables->next)
{ {
if (!strcmp(alias_str,tables->alias) && !strcmp(ptr->db, tables->db)) if (!my_strcasecmp(table_alias_charset, alias_str, tables->alias) &&
!strcmp(ptr->db, tables->db))
{ {
net_printf(thd,ER_NONUNIQ_TABLE,alias_str); /* purecov: tested */ net_printf(thd,ER_NONUNIQ_TABLE,alias_str); /* purecov: tested */
DBUG_RETURN(0); /* purecov: tested */ DBUG_RETURN(0); /* purecov: tested */
......
...@@ -9376,7 +9376,7 @@ void st_select_lex::print(THD *thd, String *str) ...@@ -9376,7 +9376,7 @@ void st_select_lex::print(THD *thd, String *str)
str->append(table->db); str->append(table->db);
str->append('.'); str->append('.');
str->append(table->real_name); str->append(table->real_name);
if (strcmp(table->real_name, table->alias)) if (my_strcasecmp(table_alias_charset, table->real_name, table->alias))
{ {
str->append(' '); str->append(' ');
str->append(table->alias); str->append(table->alias);
......
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