When calling the same stored procedure multiple times with different arguments over the course of a single connection, the later calls may return wrong result sets.
The following example illustrates the issue. First, some setup:
Now, create a new connection to the DBMS and run the following statements:
I get one result row for each statement (with the content id=1). However, the second statement should return two rows (1 and 2).
Create a new connection again, and run the following:
When I do that, I get the correct result (1 and 2). Running any further sequence of the above two statements on that same connection appears to yield the correct results as well (e.g. if we follow with CALL test_proc(0); and then CALL test_proc(1); again, it will still return the correct rows 1 and 2).
Note: This is probably the same issue described in this StackOverflow question: https://stackoverflow.com/questions/43363500/mysql-inconsistent-query-results-in-procedure-with-temp-tables-empty-resultset