Revert change of lower-case-table handling as this breaks how alias works.
Changes like this should be done to 4.1, not to a stable release mysql-test/r/lowercase_table.result: Revert change of lower-case-table handling mysql-test/t/lowercase_table.test: Revert change of lower-case-table handling sql/sql_class.cc: Revert change of lower-case-table handling sql/sql_class.h: Revert change of lower-case-table handling sql/sql_parse.cc: Revert change of lower-case-table handling sql/sql_table.cc: Revert change of lower-case-table handling sql/sql_yacc.yy: Revert change of lower-case-table handling
This commit is contained in:
parent
2db7d27f0e
commit
6d17d7f5bb
@ -6,6 +6,14 @@ id Word
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
SELECT T1.id from T1 LIMIT 1;
|
||||
id
|
||||
1
|
||||
SELECT T2.id from t1 as T2 LIMIT 1;
|
||||
id
|
||||
1
|
||||
SELECT T2.id from t1 as t2 LIMIT 1;
|
||||
Unknown table 'T2' in field list
|
||||
RENAME TABLE T1 TO T2;
|
||||
ALTER TABLE T2 ADD new_col int not null;
|
||||
ALTER TABLE T2 RENAME T3;
|
||||
@ -21,8 +29,7 @@ select count(*) from t1;
|
||||
count(*)
|
||||
0
|
||||
select count(T1.a) from t1;
|
||||
count(T1.a)
|
||||
0
|
||||
Unknown table 'T1' in field list
|
||||
select count(bags.a) from t1 as Bags;
|
||||
Unknown table 'bags' in field list
|
||||
drop table t1;
|
||||
|
@ -6,6 +6,10 @@ drop table if exists t1,t2,t3;
|
||||
create table T1 (id int primary key, Word varchar(40) not null, Index(Word));
|
||||
INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c');
|
||||
SELECT * FROM t1;
|
||||
SELECT T1.id from T1 LIMIT 1;
|
||||
SELECT T2.id from t1 as T2 LIMIT 1;
|
||||
--error 1109
|
||||
SELECT T2.id from t1 as t2 LIMIT 1;
|
||||
RENAME TABLE T1 TO T2;
|
||||
ALTER TABLE T2 ADD new_col int not null;
|
||||
ALTER TABLE T2 RENAME T3;
|
||||
@ -18,6 +22,7 @@ drop table t3;
|
||||
create table t1 (a int);
|
||||
select count(*) from T1;
|
||||
select count(*) from t1;
|
||||
--error 1109
|
||||
select count(T1.a) from t1;
|
||||
--error 1109
|
||||
select count(bags.a) from t1 as Bags;
|
||||
|
@ -430,29 +430,6 @@ void THD::close_active_vio()
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
Table Ident
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
Table_ident::Table_ident(LEX_STRING db_arg,LEX_STRING table_arg,bool force)
|
||||
:table(table_arg)
|
||||
{
|
||||
if (!force && (current_thd->client_capabilities & CLIENT_NO_SCHEMA))
|
||||
db.str=0;
|
||||
else
|
||||
db= db_arg;
|
||||
if (db.str)
|
||||
table_case_convert(db.str,db.length);
|
||||
table_case_convert(table.str,table.length);
|
||||
}
|
||||
|
||||
Table_ident::Table_ident(LEX_STRING table_arg) :table(table_arg)
|
||||
{
|
||||
db.str=0;
|
||||
table_case_convert(table.str,table.length);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
** Functions to provide a interface to select results
|
||||
*****************************************************************************/
|
||||
|
@ -762,8 +762,15 @@ class Table_ident :public Sql_alloc {
|
||||
public:
|
||||
LEX_STRING db;
|
||||
LEX_STRING table;
|
||||
Table_ident(LEX_STRING db_arg,LEX_STRING table_arg,bool force);
|
||||
Table_ident(LEX_STRING table_arg);
|
||||
inline Table_ident(LEX_STRING db_arg,LEX_STRING table_arg,bool force)
|
||||
:table(table_arg)
|
||||
{
|
||||
if (!force && (current_thd->client_capabilities & CLIENT_NO_SCHEMA))
|
||||
db.str=0;
|
||||
else
|
||||
db= db_arg;
|
||||
}
|
||||
inline Table_ident(LEX_STRING table_arg) :table(table_arg) {db.str=0;}
|
||||
inline void change_db(char *db_name)
|
||||
{ db.str= db_name; db.length=(uint) strlen(db_name); }
|
||||
};
|
||||
|
@ -3396,10 +3396,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
|
||||
}
|
||||
|
||||
ptr->alias= alias_str;
|
||||
#ifdef TO_BE_DELETED
|
||||
if (lower_case_table_names)
|
||||
casedn_str(table->table.str);
|
||||
#endif
|
||||
table_case_convert(table->table.str, table->table.length);
|
||||
ptr->real_name=table->table.str;
|
||||
ptr->real_name_length=table->table.length;
|
||||
ptr->lock_type= lock_type;
|
||||
|
@ -1463,10 +1463,8 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
{
|
||||
strmov(new_name_buff,new_name);
|
||||
fn_same(new_name_buff,table_name,3);
|
||||
#ifdef TO_BE_DELETED
|
||||
if (lower_case_table_names)
|
||||
casedn_str(new_name);
|
||||
#endif
|
||||
if ((lower_case_table_names &&
|
||||
!my_strcasecmp(new_name_buff,table_name)) ||
|
||||
(!lower_case_table_names &&
|
||||
|
@ -3221,20 +3221,16 @@ simple_ident:
|
||||
| ident '.' ident
|
||||
{
|
||||
SELECT_LEX *sel=Select;
|
||||
table_case_convert($1.str, $1.length);
|
||||
$$ = !sel->create_refs || sel->in_sum_expr > 0 ? (Item*) new Item_field(NullS,$1.str,$3.str) : (Item*) new Item_ref(NullS,$1.str,$3.str);
|
||||
}
|
||||
| '.' ident '.' ident
|
||||
{
|
||||
SELECT_LEX *sel=Select;
|
||||
table_case_convert($2.str,$2.length);
|
||||
$$ = !sel->create_refs || sel->in_sum_expr > 0 ? (Item*) new Item_field(NullS,$2.str,$4.str) : (Item*) new Item_ref(NullS,$2.str,$4.str);
|
||||
}
|
||||
| ident '.' ident '.' ident
|
||||
{
|
||||
SELECT_LEX *sel=Select;
|
||||
table_case_convert($1.str,$1.length);
|
||||
table_case_convert($3.str,$3.length);
|
||||
$$ = !sel->create_refs || sel->in_sum_expr > 0 ? (Item*) new Item_field((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str) : (Item*) new Item_ref((current_thd->client_capabilities & CLIENT_NO_SCHEMA ? NullS :$1.str),$3.str,$5.str);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user