[MDEV-24460] Multiple rows result set returned from stored routine over prepared statement binary protocol is handled incorrectly Created: 2020-12-21 Updated: 2021-06-17 Resolved: 2021-02-07 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Tests |
| Affects Version/s: | 10.6.0 |
| Fix Version/s: | 10.6.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Dmitry Shulga | Assignee: | Dmitry Shulga |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
While working on the task Test's content:
This test case creates the procedure p1() that iterates as many times as specified by its parameter value and executes the statement "select 'test' AS test_column;" on every iteration. So, it is expected that this test case outputs is:
Unfortunately, Test output is below. I marked my comments with the prefix '<<<<'
To determine who is blame - server or client - in wrong test output I debugged the server and and printed a content of the buffer that is sent from server to the client during execution of the CALL statement. Logic for handling of the CALL statement is implement by the method execute() of the class Sql_cmd_call. So I ran mtr test under debugger, set breakpoint to this member and ran the test case. When server execution under debugger hit the method Sql_cmd_call::execute In result I discovered two invocations of net_real_write () as it was expected (every time it was done right after finishing execution of the function execute_sqlcom_select() and it is also expected time and place to do it). Both time the same buffer content was output to socket:
Parsed representation of this buffer is below:
So, database server processed the query correctly and sent well-formed answer message in accrodning with binary protocol.
was mishandled or silently ignored. |
| Comments |
| Comment by Georg Richter [ 2020-12-21 ] | |||
|
Connector/C has a bunch of tests handling stored procedures with multiple result sets and output variables which all passes. The problem is caused by mysqltest.cc, which only handles the first result set in run_query_stmt() function instead of looping through result sets with
I didn't check other versions but likely all server versions are affected. |