Bug #6102 Server crash with prepared statement and blank after functionname
Submitted: 14 Oct 2004 15:15 Modified: 5 Nov 2004 19:03
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.2 OS:Linux (Linux)
Assigned to: Konstantin Osipov CPU Architecture:Any

[14 Oct 2004 15:15] Georg Richter
Description:
Not tested against 4.1.6 yet. 
 
When adding a blank between function name and parenthesis mysql_stmt_prepare crashes server. 

How to repeat:
5.0.2-alpha-debug-log 
[17:11] root@test> create table t1 (a varchar(20)); 
Query OK, 0 rows affected (0.09 sec) 
 
5.0.2-alpha-debug-log 
[17:11] root@test> insert into t1 values ('foo'); 
Query OK, 1 row affected (0.00 sec) 
 
5.0.2-alpha-debug-log 
[17:11] root@test> prepare my_stmt FROM 'SELECT char_length (a) FROM t1'; 
ERROR 2013 (HY000): Lost connection to MySQL server during query 
5.0.2-alpha-debug-log
[14 Oct 2004 15:59] MySQL Verification Team
Verified with 5.0.2.

With 4.1.6-gamma-debug-log:

mysql> prepare my_stmt FROM 'SELECT char_length (a) FROM t1';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(a) FROM t1' at line 1
[5 Nov 2004 12:49] Konstantin Osipov
Subject: bk commit - 5.0 tree (konstantin:1.1696) BUG#6102

ChangeSet
  1.1696 04/11/05 15:45:31 konstantin@mysql.com +3 -0
  A fix and test case for Bug#6102 "Server crash with prepared statement
  and blank after function name".
  Crop fruits of copy-paste programming: pre-caching of stored functions
  wasn't performed for prepared statements just because implementation
  of prepared statements is done as an add-on to the main execution flow,
  and the preload was originally implemented for main execution branch
  only (mysql_execute_command).
[5 Nov 2004 19:03] Konstantin Osipov
Fixed in 5.0.3