summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 8ce5c9703ef..25d6f723628 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -15801,8 +15801,8 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
uint temp_pool_slot=MY_BIT_NONE;
uint fieldnr= 0;
ulong reclength, string_total_length;
- bool using_unique_constraint= 0;
- bool use_packed_rows= 0;
+ bool using_unique_constraint= false;
+ bool use_packed_rows= false;
bool not_all_columns= !(select_options & TMP_TABLE_ALL_COLUMNS);
char *tmpname,path[FN_REFLEN];
uchar *pos, *group_buff, *bitmaps;
@@ -15875,10 +15875,10 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*/
(*tmp->item)->marker=4; // Store null in key
if ((*tmp->item)->too_big_for_varchar())
- using_unique_constraint=1;
+ using_unique_constraint= true;
}
if (param->group_length >= MAX_BLOB_WIDTH)
- using_unique_constraint=1;
+ using_unique_constraint= true;
if (group)
distinct=0; // Can't use distinct
}
@@ -16131,12 +16131,14 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
*blob_field++= fieldnr;
blob_count++;
}
+
if (new_field->real_type() == MYSQL_TYPE_STRING ||
new_field->real_type() == MYSQL_TYPE_VARCHAR)
{
string_count++;
string_total_length+= new_field->pack_length();
}
+
if (item->marker == 4 && item->maybe_null)
{
group_null_items++;
@@ -16189,7 +16191,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
if (group &&
(param->group_parts > table->file->max_key_parts() ||
param->group_length > table->file->max_key_length()))
- using_unique_constraint=1;
+ using_unique_constraint= true;
}
else
{
@@ -17102,7 +17104,10 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
start_recinfo,
share->uniques, &uniquedef,
&create_info,
- HA_CREATE_TMP_TABLE | HA_CREATE_INTERNAL_TABLE)))
+ HA_CREATE_TMP_TABLE | HA_CREATE_INTERNAL_TABLE |
+ ((share->db_create_options & HA_OPTION_PACK_RECORD) ?
+ HA_PACK_RECORD : 0)
+ )))
{
table->file->print_error(error,MYF(0)); /* purecov: inspected */
table->db_stat=0;