mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Merge mysql.com:/home/psergey/tmp_merge
into mysql.com:/home/psergey/mysql-5.1-merge5 sql/sql_select.cc: Auto merged
This commit is contained in:
@ -2419,7 +2419,19 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
|
||||
{
|
||||
if (old->field == new_fields->field)
|
||||
{
|
||||
if (new_fields->val->used_tables())
|
||||
/*
|
||||
NOTE: below const_item() call really works as "!used_tables()", i.e.
|
||||
it can return FALSE where it is feasible to make it return TRUE.
|
||||
|
||||
The cause is as follows: Some of the tables are already known to be
|
||||
const tables (the detection code is in make_join_statistics(),
|
||||
above the update_ref_and_keys() call), but we didn't propagate
|
||||
information about this: TABLE::const_table is not set to TRUE, and
|
||||
Item::update_used_tables() hasn't been called for each item.
|
||||
The result of this is that we're missing some 'ref' accesses.
|
||||
TODO: OptimizerTeam: Fix this
|
||||
*/
|
||||
if (!new_fields->val->const_item())
|
||||
{
|
||||
/*
|
||||
If the value matches, we can use the key reference.
|
||||
@ -2449,7 +2461,8 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
|
||||
new_fields->null_rejecting);
|
||||
}
|
||||
else if (old->eq_func && new_fields->eq_func &&
|
||||
(old->val->is_null() || new_fields->val->is_null()))
|
||||
((old->val->const_item() && old->val->is_null()) ||
|
||||
new_fields->val->is_null()))
|
||||
{
|
||||
/* field = expression OR field IS NULL */
|
||||
old->level= and_level;
|
||||
|
Reference in New Issue
Block a user