List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:October 12 1999 2:44am
Subject:COUNT(DISTINCT col) craches server
View as plain text  
>>>>> "Thomas" == Thomas van Gulick
> <list@stripped> writes:

Thomas> I just created a new table with a char(80) field and tried to do a SELECT
> COUNT(DISTINCT col_name) on it while it was still empty .. it makes my mysqld crash ...

Hi!

Fix:

(/my/monty/sql) diff -c /my/monty/master/mysql-3.23.4-alpha/sql/item_sum.cc .
*** /my/monty/master/mysql-3.23.4-alpha/sql/item_sum.cc Tue Aug 31 02:55:03 1999
--- ./item_sum.cc       Tue Oct 12 05:41:29 1999
***************
*** 845,850 ****
--- 845,852 ----

  longlong Item_sum_count_distinct::val_int()
  {
+   if (!table)                                 // Empty query
+     return LL(0);
    ha_info(table,2);
    return table->keyfile_info.records;
  }


Regards,
Monty
Thread
COUNT(DISTINCT col) craches serverThomas van Gulick10 Oct
  • Re: COUNT(DISTINCT col) craches serverTonu Samuel10 Oct
  • COUNT(DISTINCT col) craches serverMichael Widenius12 Oct