Commit 6158c94b authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work-alias-4.1
parents 5c4b54f4 bbb6642a
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 t4 (id int primary key, Word varchar(40) not null);
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;
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;
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 @@
#
--disable_warnings
drop table if exists t1,t2,t3,t4,T1;
drop table if exists t1,t2,t3,t4;
--enable_warnings
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;
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;
#
# 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,9 +456,8 @@ bool Item_field::eq(const Item *item, bool binary_cmp) const
(!my_strcasecmp(table_alias_charset, item_field->table_name,
table_name) &&
(!item_field->db_name ||
(item_field->db_name && !my_strcasecmp(table_alias_charset,
item_field->db_name,
db_name))))));
(item_field->db_name && !strcmp(item_field->db_name,
db_name))))));
}
......
......@@ -141,7 +141,7 @@ class sys_var_str :public sys_var
sys_update_func update_func_arg,
sys_set_default_func set_default_func_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)
{}
bool check(THD *thd, set_var *var);
......
......@@ -1259,12 +1259,7 @@ void Query_cache::invalidate(char *db)
do
{
next= curr->next;
/*
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)
if (strcmp(db, (char*)(curr->table()->db())) == 0)
invalidate_table(curr);
/*
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,
found_other_files++;
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))
{
/* Drop the table nicely */
......
......@@ -2712,7 +2712,7 @@ mysql_execute_command(THD *thd)
for (walk= (TABLE_LIST*) tables; walk; walk= walk->next)
{
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;
}
if (!walk)
......@@ -4495,7 +4495,8 @@ TABLE_LIST *st_select_lex::add_table_to_list(THD *thd,
tables ;
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 */
DBUG_RETURN(0); /* purecov: tested */
......
......@@ -9376,7 +9376,7 @@ void st_select_lex::print(THD *thd, String *str)
str->append(table->db);
str->append('.');
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(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