Fix problem in MIN/MAX optimisation (from last patch)
Don't make OLD_PASSWORD() a reserved word
This commit is contained in:
parent
f68914addb
commit
1b9b042654
@ -31,3 +31,16 @@ drop table t1;
|
||||
explain select 1;
|
||||
Comment
|
||||
No tables used
|
||||
create table t1 (a int not null);
|
||||
explain select count(*) from t1;
|
||||
Comment
|
||||
Select tables optimized away
|
||||
insert into t1 values(1);
|
||||
explain select count(*) from t1;
|
||||
Comment
|
||||
Select tables optimized away
|
||||
insert into t1 values(1);
|
||||
explain select count(*) from t1;
|
||||
Comment
|
||||
Select tables optimized away
|
||||
drop table t1;
|
||||
|
@ -1,6 +1,9 @@
|
||||
select length(encrypt('foo', 'ff')) <> 0;
|
||||
length(encrypt('foo', 'ff')) <> 0
|
||||
1
|
||||
select password('test'),length(encrypt('test')),encrypt('test','aa');
|
||||
password('test') length(encrypt('test')) encrypt('test','aa')
|
||||
378b243e220ca493 13 aaqPiZY5xR5l.
|
||||
select old_password('test'), password('test');
|
||||
old_password('test') password('test')
|
||||
378b243e220ca493 378b243e220ca493
|
||||
select length(encrypt('test')), encrypt('test','aa');
|
||||
length(encrypt('test')) encrypt('test','aa')
|
||||
13 aaqPiZY5xR5l.
|
||||
|
@ -20,3 +20,11 @@ explain select * from t1 ignore key (str,str,foo) where str="foo";
|
||||
drop table t1;
|
||||
|
||||
explain select 1;
|
||||
|
||||
create table t1 (a int not null);
|
||||
explain select count(*) from t1;
|
||||
insert into t1 values(1);
|
||||
explain select count(*) from t1;
|
||||
insert into t1 values(1);
|
||||
explain select count(*) from t1;
|
||||
drop table t1;
|
||||
|
@ -2,4 +2,5 @@
|
||||
|
||||
select length(encrypt('foo', 'ff')) <> 0;
|
||||
--replace_result $1$aa$4OSUA5cjdx0RUQ08opV27/ aaqPiZY5xR5l.
|
||||
select password('test'),length(encrypt('test')),encrypt('test','aa');
|
||||
select old_password('test'), password('test');
|
||||
select length(encrypt('test')), encrypt('test','aa');
|
||||
|
@ -307,6 +307,11 @@ Item *create_func_quarter(Item* a)
|
||||
return new Item_func_quarter(a);
|
||||
}
|
||||
|
||||
Item *create_func_password(Item* a)
|
||||
{
|
||||
return new Item_func_password(a);
|
||||
}
|
||||
|
||||
Item *create_func_radians(Item *a)
|
||||
{
|
||||
return new Item_func_units((char*) "radians",a,M_PI/180,0.0);
|
||||
|
@ -70,6 +70,7 @@ Item *create_func_pi(void);
|
||||
Item *create_func_pow(Item* a, Item *b);
|
||||
Item *create_func_current_user(void);
|
||||
Item *create_func_quarter(Item* a);
|
||||
Item *create_func_password(Item* a);
|
||||
Item *create_func_radians(Item *a);
|
||||
Item *create_func_release_lock(Item* a);
|
||||
Item *create_func_repeat(Item* a, Item *b);
|
||||
|
@ -260,7 +260,6 @@ static SYMBOL symbols[] = {
|
||||
{ "NULL", SYM(NULL_SYM),0,0},
|
||||
{ "NUMERIC", SYM(NUMERIC_SYM),0,0},
|
||||
{ "OFFSET", SYM(OFFSET_SYM),0,0},
|
||||
{ "OLD_PASSWORD", SYM(PASSWORD),0,0},
|
||||
{ "ON", SYM(ON),0,0},
|
||||
{ "OPEN", SYM(OPEN_SYM),0,0},
|
||||
{ "OPTIMIZE", SYM(OPTIMIZE),0,0},
|
||||
@ -475,6 +474,7 @@ static SYMBOL sql_functions[] = {
|
||||
{ "NULLIF", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_nullif)},
|
||||
{ "OCTET_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_length)},
|
||||
{ "OCT", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_oct)},
|
||||
{ "OLD_PASSWORD", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_password)},
|
||||
{ "ORD", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ord)},
|
||||
{ "PERIOD_ADD", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_period_add)},
|
||||
{ "PERIOD_DIFF", SYM(FUNC_ARG2),0,CREATE_FUNC(create_func_period_diff)},
|
||||
|
@ -23,8 +23,6 @@
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
@ -245,8 +245,15 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
|
||||
const_result=0;
|
||||
}
|
||||
}
|
||||
if (used_tables != removed_tables)
|
||||
const_result=0; // We didn't remove all tables
|
||||
/*
|
||||
If we have a where clause, we can only ignore searching in the
|
||||
tables if MIN/MAX optimisation replaced all used tables
|
||||
This is to not to use replaced values in case of:
|
||||
SELECT MIN(key) FROM table_1, empty_table
|
||||
removed_tables is != 0 if we have used MIN() or MAX().
|
||||
*/
|
||||
if (removed_tables && used_tables != removed_tables)
|
||||
const_result= 0; // We didn't remove all tables
|
||||
return const_result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user