diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-07-17 16:56:21 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-07-17 16:56:21 +0200 |
commit | e5c26fdfab3d43ad2b0524a3bf29f59f6fab37d8 (patch) | |
tree | 57b7e29f042bb3a98e8c76a3f9285a2b81c2250f /sql/table.cc | |
parent | 1fd84f9129f2ed98706f6e225b06b16a13d0ebd0 (diff) | |
parent | 2fbf2277ffec86d69f793534da7043b6dd540780 (diff) | |
download | mariadb-git-e5c26fdfab3d43ad2b0524a3bf29f59f6fab37d8.tar.gz |
Merge branch '5.5' into bb-10.0-merge
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sql/table.cc b/sql/table.cc index 85dffeb9167..5ea5d8cf3c5 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -5574,7 +5574,7 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_ nj_col= natural_join_it.column_ref(); DBUG_ASSERT(nj_col); } - DBUG_ASSERT(!nj_col->table_field || + DBUG_ASSERT(!nj_col->table_field || !nj_col->table_field->field || nj_col->table_ref->table == nj_col->table_field->field->table); /* @@ -5623,7 +5623,7 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_ RETURN # Pointer to a column of a natural join (or its operand) - NULL No memory to allocate the column + NULL We didn't originally have memory to allocate the column */ Natural_join_column * @@ -5639,7 +5639,7 @@ Field_iterator_table_ref::get_natural_column_ref() */ nj_col= natural_join_it.column_ref(); DBUG_ASSERT(nj_col && - (!nj_col->table_field || + (!nj_col->table_field || !nj_col->table_field->field || nj_col->table_ref->table == nj_col->table_field->field->table)); return nj_col; } @@ -6193,6 +6193,14 @@ void TABLE::create_key_part_by_field(KEY_PART_INFO *key_part_info, The function checks whether a possible key satisfies the constraints imposed on the keys of any temporary table. + We need to filter out BLOB columns here, because ref access optimizer creates + KEYUSE objects for equalities for non-key columns for two puproses: + 1. To discover possible keys for derived_with_keys optimization + 2. To do hash joins + For the purpose of #1, KEYUSE objects are not created for "blob_column=..." . + However, they might be created for #2. In order to catch that case, we filter + them out here. + @return TRUE if the key is valid @return FALSE otherwise */ @@ -6208,11 +6216,12 @@ bool TABLE::check_tmp_key(uint key, uint key_parts, { uint fld_idx= next_field_no(arg); reg_field= field + fld_idx; + if ((*reg_field)->type() == MYSQL_TYPE_BLOB) + return FALSE; uint fld_store_len= (uint16) (*reg_field)->key_length(); if ((*reg_field)->real_maybe_null()) fld_store_len+= HA_KEY_NULL_LENGTH; - if ((*reg_field)->type() == MYSQL_TYPE_BLOB || - (*reg_field)->real_type() == MYSQL_TYPE_VARCHAR || + if ((*reg_field)->real_type() == MYSQL_TYPE_VARCHAR || (*reg_field)->type() == MYSQL_TYPE_GEOMETRY) fld_store_len+= HA_KEY_BLOB_LENGTH; key_len+= fld_store_len; |