Bug #166 select @@not_a_variable closes the connection
Submitted: 19 Mar 2003 6:51 Modified: 19 Mar 2003 7:48
Reporter: Michael Kofler Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0.12 OS:Any (ALL)
Assigned to: CPU Architecture:Any

[19 Mar 2003 6:51] Michael Kofler
Description:
After processing select @@var where var is NOT a know system variable, the connection is dropped.

How to repeat:
mysql> select @@not_a_variable;
ERROR 1193: Unknown system variable 'not_a_variable'
mysql> select 1;
ERROR 2013: Lost connection to MySQL server during query

(This error does NOT apply to the Linux version of MySQL. Test under Windows.)

Suggested fix:
should work as in the linux version
[19 Mar 2003 7:48] Sinisa Milivojevic
===== sql/item_func.cc 1.89 vs edited =====
*** /tmp/item_func.cc-1.89-370  Tue Mar 18 23:13:45 2003
--- edited/sql/item_func.cc     Wed Mar 19 17:39:38 2003
***************
*** 2382,2391 ****
    char buff[MAX_SYS_VAR_LENGTH+3+8], *pos;
  
    if (!(var= find_sys_var(name.str)))
-   {
-     net_printf(&thd->net, ER_UNKNOWN_SYSTEM_VARIABLE, name.str);
      return 0;
-   }
    if (!(item=var->item(thd, var_type)))
      return 0;                                 // Impossible
    thd->safe_to_cache_query=0;
--- 2382,2388 ----