From af6a7eebe4f0bcd246662e672827c7ad124f1806 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 3 Sep 2002 21:31:08 +0300 Subject: [PATCH] a small fix for a distinct query --- sql/sql_select.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 11b89722017..6402e29a3ef 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -640,8 +640,8 @@ mysql_select(THD *thd,TABLE_LIST *tables,List &fields,COND *conds, DBUG_PRINT("info",("Creating tmp table")); thd->proc_info="Creating tmp table"; - join.tmp_table_param.hidden_field_count=(all_fields.elements- - fields.elements); + join.tmp_table_param.hidden_field_count= + (all_fields.elements > fields.elements) ? (all_fields.elements- fields.elements) : 0; if (!(tmp_table = create_tmp_table(thd,&join.tmp_table_param,all_fields, ((!simple_group && !procedure &&