Bug #38340 assertion failed
Submitted: 24 Jul 2008 10:06 Modified: 26 Sep 2008 9:03
Reporter: Yordan Georgiev Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Proxy: Core Severity:S1 (Critical)
Version:0.6.1 OS:Linux
Assigned to: CPU Architecture:Any
Tags: mysql-proxy

[24 Jul 2008 10:06] Yordan Georgiev
Description:
  query             = SELECT * FROM Messages where Sender_id=\'6053723056\'
**
** ERROR:(sql-tokenizer.l:411):sql_token_append_last_token: assertion failed: (tokens->len > 0)
Aborted

How to repeat:
1. # mysql --host=10.10.10.208 --port=4040
2. use test
3. SELECT * FROM Messages where Sender_id=\'6053723056\';
[24 Jul 2008 13:28] Jan Kneschke
which script are you using for the query ?

Executing the Query against a mysqld gives:

  root@192.168.2.102:3306 [test]> SELECT * FROM t1 WHERE id = \'1\';
  ERROR:
  Unknown command '\''.
  ERROR:
  Unknown command '\''.
  ERROR 1064 (42000): You have an error ... near '\'1\'' at line 1

The result is the same if a proxy script is calling the tokenizer (using svn-trunk).

This looks like a duplicate of http://bugs.mysql.com/bug.php?id=36506
[24 Jul 2008 18:28] Yordan Georgiev
# mysql -V
mysql  Ver 14.12 Distrib 5.0.51b, for unknown-linux-gnu (x86_64) using  EditLine wrapper

# cat test
<?php
for ($i = 1; $i <= 101354; $i++) {
$link = mysql_connect('10.10.10.208:4040', 'root', 'rootpass');
mysql_select_db('elmaz', $link);
$sql = "SELECT * FROM Messages where Sender_id=\'".rand(9999,9999999999)."\'";
#$sql = "select @@version_comment limit 1";
mysql_query($sql);
echo $sql;
echo "\n";
}
?>

/usr/local/mysql-proxy/sbin/mysql-proxy -V
mysql-proxy 0.6.1
[24 Jul 2008 18:31] Yordan Georgiev
svn trunk:
./configure --prefix=/usr/local/mysql-proxy --with-mysql=/usr/local/mysql/bin/mysql_config --with-lua --enable-maintainer-mode --enable-dependency-tracking  --with-gnu-ld

mysql> select * from proxy_config;
ERROR 1105 (07000): (admin-server) query not known
mysql>
[26 Sep 2008 9:03] Sveta Smirnova
Thank you for the feedback.

"SELECT * FROM Messages where Sender_id=\'".rand(9999,9999999999)."\'"; is invalid query (you don't need escape ' inside double quotes in PHP), so I close this report as duplicate of bug #36506