mirror of
https://github.com/MariaDB/server.git
synced 2025-07-04 01:23:45 +03:00
Outer joins cleanup: Remove TABLE::outer_join and use TABLE::maybe_null only (2nd patch after Monty's comments).
sql/mysql_priv.h: Outer joins cleanup: Remove TABLE::outer_join and use TABLE::maybe_null only. sql/opt_range.cc: Outer joins cleanup: Remove TABLE::outer_join and use TABLE::maybe_null only. sql/sql_base.cc: Outer joins cleanup: Remove TABLE::outer_join and use TABLE::maybe_null only. sql/sql_select.cc: Outer joins cleanup: Remove TABLE::outer_join and use TABLE::maybe_null only. sql/table.h: Outer joins cleanup: * Remove TABLE::outer_join and use TABLE::maybe_null only. * Added comments.
This commit is contained in:
@ -1329,7 +1329,7 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr)
|
|||||||
table->null_row= 0;
|
table->null_row= 0;
|
||||||
table->status= STATUS_NO_RECORD;
|
table->status= STATUS_NO_RECORD;
|
||||||
table->keys_in_use_for_query= table->s->keys_in_use;
|
table->keys_in_use_for_query= table->s->keys_in_use;
|
||||||
table->maybe_null= test(table->outer_join= table_list->outer_join);
|
table->maybe_null= table_list->outer_join;
|
||||||
table->tablenr= tablenr;
|
table->tablenr= tablenr;
|
||||||
table->map= (table_map) 1 << tablenr;
|
table->map= (table_map) 1 << tablenr;
|
||||||
table->force_index= table_list->force_index;
|
table->force_index= table_list->force_index;
|
||||||
|
@ -3611,7 +3611,7 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
|
|||||||
|
|
||||||
if (!value) // IS NULL or IS NOT NULL
|
if (!value) // IS NULL or IS NOT NULL
|
||||||
{
|
{
|
||||||
if (field->table->outer_join) // Can't use a key on this
|
if (field->table->maybe_null) // Can't use a key on this
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
if (!maybe_null) // Not null field
|
if (!maybe_null) // Not null field
|
||||||
DBUG_RETURN(type == Item_func::ISNULL_FUNC ? &null_element : 0);
|
DBUG_RETURN(type == Item_func::ISNULL_FUNC ? &null_element : 0);
|
||||||
|
@ -854,7 +854,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list)
|
|||||||
table->tablenr=thd->current_tablenr++;
|
table->tablenr=thd->current_tablenr++;
|
||||||
table->used_fields=0;
|
table->used_fields=0;
|
||||||
table->const_table=0;
|
table->const_table=0;
|
||||||
table->outer_join= table->null_row= table->maybe_null= table->force_index= 0;
|
table->null_row= table->maybe_null= table->force_index= 0;
|
||||||
table->status=STATUS_NO_RECORD;
|
table->status=STATUS_NO_RECORD;
|
||||||
table->keys_in_use_for_query= share->keys_in_use;
|
table->keys_in_use_for_query= share->keys_in_use;
|
||||||
table->used_keys= share->keys_for_keyread;
|
table->used_keys= share->keys_for_keyread;
|
||||||
@ -1078,7 +1078,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
|||||||
table->tablenr=thd->current_tablenr++;
|
table->tablenr=thd->current_tablenr++;
|
||||||
table->used_fields=0;
|
table->used_fields=0;
|
||||||
table->const_table=0;
|
table->const_table=0;
|
||||||
table->outer_join= table->null_row= table->maybe_null= table->force_index= 0;
|
table->null_row= table->maybe_null= table->force_index= 0;
|
||||||
table->status=STATUS_NO_RECORD;
|
table->status=STATUS_NO_RECORD;
|
||||||
table->keys_in_use_for_query= table->s->keys_in_use;
|
table->keys_in_use_for_query= table->s->keys_in_use;
|
||||||
table->insert_values= 0;
|
table->insert_values= 0;
|
||||||
@ -1150,7 +1150,6 @@ bool reopen_table(TABLE *table,bool locked)
|
|||||||
tmp.tablenr= table->tablenr;
|
tmp.tablenr= table->tablenr;
|
||||||
tmp.used_fields= table->used_fields;
|
tmp.used_fields= table->used_fields;
|
||||||
tmp.const_table= table->const_table;
|
tmp.const_table= table->const_table;
|
||||||
tmp.outer_join= table->outer_join;
|
|
||||||
tmp.null_row= table->null_row;
|
tmp.null_row= table->null_row;
|
||||||
tmp.maybe_null= table->maybe_null;
|
tmp.maybe_null= table->maybe_null;
|
||||||
tmp.status= table->status;
|
tmp.status= table->status;
|
||||||
|
@ -9181,7 +9181,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
|
|||||||
tab->info="const row not found";
|
tab->info="const row not found";
|
||||||
/* Mark for EXPLAIN that the row was not found */
|
/* Mark for EXPLAIN that the row was not found */
|
||||||
pos->records_read=0.0;
|
pos->records_read=0.0;
|
||||||
if (!table->outer_join || error > 0)
|
if (!table->maybe_null || error > 0)
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9200,7 +9200,7 @@ join_read_const_table(JOIN_TAB *tab, POSITION *pos)
|
|||||||
tab->info="unique row not found";
|
tab->info="unique row not found";
|
||||||
/* Mark for EXPLAIN that the row was not found */
|
/* Mark for EXPLAIN that the row was not found */
|
||||||
pos->records_read=0.0;
|
pos->records_read=0.0;
|
||||||
if (!table->outer_join || error > 0)
|
if (!table->maybe_null || error > 0)
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
if (table->key_read)
|
if (table->key_read)
|
||||||
|
14
sql/table.h
14
sql/table.h
@ -217,14 +217,18 @@ struct st_table {
|
|||||||
uint derived_select_number;
|
uint derived_select_number;
|
||||||
int current_lock; /* Type of lock on table */
|
int current_lock; /* Type of lock on table */
|
||||||
my_bool copy_blobs; /* copy_blobs when storing */
|
my_bool copy_blobs; /* copy_blobs when storing */
|
||||||
|
|
||||||
|
/*
|
||||||
|
0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0.
|
||||||
|
If maybe_null !=0, this table is inner w.r.t. some outer join operation,
|
||||||
|
and null_row may be true.
|
||||||
|
*/
|
||||||
|
uint maybe_null;
|
||||||
/*
|
/*
|
||||||
Used in outer joins: if true, all columns are considered to have NULL
|
If true, the current table row is considered to have all columns set to
|
||||||
values, including columns declared as "not null".
|
NULL, including columns declared as "not null" (see maybe_null).
|
||||||
*/
|
*/
|
||||||
my_bool null_row;
|
my_bool null_row;
|
||||||
/* 0 or JOIN_TYPE_{LEFT|RIGHT}, same as TABLE_LIST::outer_join */
|
|
||||||
my_bool outer_join;
|
|
||||||
my_bool maybe_null; /* true if (outer_join != 0) */
|
|
||||||
my_bool force_index;
|
my_bool force_index;
|
||||||
my_bool distinct,const_table,no_rows;
|
my_bool distinct,const_table,no_rows;
|
||||||
my_bool key_read, no_keyread;
|
my_bool key_read, no_keyread;
|
||||||
|
Reference in New Issue
Block a user