Bug #20365 mysqlslap fails with error message about result sets
Submitted: 9 Jun 2006 17:58 Modified: 28 Jul 2006 20:14
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.12-beta-debug OS:Linux (SUSE 10.0)
Assigned to: Magnus Blåudd CPU Architecture:Any

[9 Jun 2006 17:58] Peter Gulutzan
Description:
I create a procedure which doesn't contain any SHOW or SELECT statements.
I say mysqlslap --query='call procedure_name()'
I get a message "ERROR: ...  can't return a result set in the given context".

How to repeat:
To create the procedure:

mysql> create database db77;
Query OK, 1 row affected (0.00 sec)

mysql> use db77;
Database changed
mysql> create procedure pmy () execute a;
Query OK, 0 rows affected (0.00 sec)

To run:

pgulutzan@linux:~> /usr/local/mysql/bin/mysqlslap --create-schema=db77 --preserve-schema --concurrency=2 --iterations=1 --query='call db77.pmy()'
/usr/local/mysql/bin/mysqlslap: Cannot run query call db77.pmy() ERROR : PROCEDURE db77.pmy can't return a result set in the given context
/usr/local/mysql/bin/mysqlslap: Cannot run query call db77.pmy() ERROR : PROCEDURE db77.pmy can't return a result set in the given context
Benchmark
        Average number of seconds to run all queries: 0.013 seconds
        Minimum number of seconds to run all queries: 0.013 seconds
        Maximum number of seconds to run all queries: 0.013 seconds
        Number of clients running queries: 2
        Average number of queries per client: 1
[11 Jun 2006 7:42] Valeriy Kravchuk
Thank you for a problem report. Verified just as described:

openxs@suse:~/dbs/5.1> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 5.1.12-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create database db77;
Query OK, 1 row affected (0.01 sec)

mysql> use db77;
Database changed
mysql> create procedure pmy () execute a;
Query OK, 0 rows affected (0.02 sec)

mysql> call pmy();
ERROR 1243 (HY000): Unknown prepared statement handler (a) given to EXECUTE
mysql> exit
Bye
openxs@suse:~/dbs/5.1> bin/mysqlslap --create-schema=db77 --preserve-schema --c
oncurrency=2 --iterations=1 --query='call db77.pmy()'
bin/mysqlslap: Cannot run query call db77.pmy() ERROR : PROCEDURE db77.pmy can't
 return a result set in the given context
bin/mysqlslap: Cannot run query call db77.pmy() ERROR : PROCEDURE db77.pmy can't
 return a result set in the given context
Benchmark
        Average number of seconds to run all queries: 0.027 seconds
        Minimum number of seconds to run all queries: 0.027 seconds
        Maximum number of seconds to run all queries: 0.027 seconds
        Number of clients running queries: 2
        Average number of queries per client: 1
[20 Jul 2006 12:51] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/9380
[27 Jul 2006 12:09] Magnus Blåudd
Pushed to 5.1.12
[28 Jul 2006 20:14] Paul DuBois
Noted in 5.1.12 changelog.

mysqlslap did not enable the CLIENT_MULTI_RESULTS flag when connecting,
which is necessary for executing stored procedures.