Item::Item(THD *thd):
  is_expensive_cache(-1), rsize(0), name(null_clex_str), orig_name(0),
  fixed(0), is_autogenerated_name(TRUE)
{
  DBUG_ASSERT(thd);
  marker= 0;
  maybe_null=null_value=with_sum_func=with_window_func=with_field=0;
  in_rollup= 0;
  with_param= 0;

   /* Initially this item is not attached to any JOIN_TAB. */
  join_tab_idx= MAX_TABLES;

  /* Put item in free list so that we can free all items at end */
  next= thd->free_list;
  thd->free_list= this;
  /*
    Item constructor can be called during execution other then SQL_COM
    command => we should check thd->lex->current_select on zero (thd->lex
    can be uninitialised)
  */
  if (thd->lex->current_select)
  {
    enum_parsing_place place= 
      thd->lex->current_select->parsing_place;
    if (place == SELECT_LIST || place == IN_HAVING)
      thd->lex->current_select->select_n_having_items++;
  }
}
Item::Item(THD *thd):
  is_expensive_cache(-1), rsize(0), name(null_clex_str), orig_name(0),
  fixed(0), is_autogenerated_name(TRUE)
{
  DBUG_ASSERT(thd);
  marker= 0;
  maybe_null=null_value=with_sum_func=with_window_func=with_field=0;
  in_rollup= 0;
  with_param= 0;

    
  join_tab_idx= MAX_TABLES;

   
  next= thd->free_list;
  thd->free_list= this;
   
  if (thd->lex->current_select)
  {
    enum_parsing_place place= 
      thd->lex->current_select->parsing_place;
    if (place == SELECT_LIST || place == IN_HAVING)
      thd->lex->current_select->select_n_having_items++;
  }
}