diff options
author | monty@mashka.mysql.fi <> | 2003-02-07 17:57:07 +0200 |
---|---|---|
committer | monty@mashka.mysql.fi <> | 2003-02-07 17:57:07 +0200 |
commit | 1b9b042654512c7013fceb135795fc4453011033 (patch) | |
tree | 47bb4c4c761190424e909ac9f98674ad71c80b6d /sql | |
parent | f68914addb4a59927cbc47c8d3a2431b5b180770 (diff) | |
download | mariadb-git-1b9b042654512c7013fceb135795fc4453011033.tar.gz |
Fix problem in MIN/MAX optimisation (from last patch)
Don't make OLD_PASSWORD() a reserved word
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_create.cc | 5 | ||||
-rw-r--r-- | sql/item_create.h | 1 | ||||
-rw-r--r-- | sql/lex.h | 2 | ||||
-rw-r--r-- | sql/opt_range.cc | 2 | ||||
-rw-r--r-- | sql/opt_sum.cc | 11 |
5 files changed, 16 insertions, 5 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index a4486a0b1c7..7e082bc174c 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -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); diff --git a/sql/item_create.h b/sql/item_create.h index 10b404ec2fd..5381ad946ae 100644 --- a/sql/item_create.h +++ b/sql/item_create.h @@ -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); diff --git a/sql/lex.h b/sql/lex.h index 64ba98b5e35..a9e44e034d0 100644 --- a/sql/lex.h +++ b/sql/lex.h @@ -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)}, diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 768344ab702..0407aabc327 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -23,8 +23,6 @@ */ - - #ifdef __GNUC__ #pragma implementation // gcc: Class implementation #endif diff --git a/sql/opt_sum.cc b/sql/opt_sum.cc index d5a4149f243..41771646082 100644 --- a/sql/opt_sum.cc +++ b/sql/opt_sum.cc @@ -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; } |