![]() Since there is a workaround (create temp table and drop it in function) I'm marking this as S3. No matter whether MySQL considers this 'by design', this is inconsistent behavior because I CAN reopen the same temporary table twice, just not if the table pre-dates the function call. In the reproduction steps I have included, you'll see that you can have sub-functions that insert, update, and select from the SAME temporary table, but only if the table was created during execution of the function. I only bring this up because bug #60718 was remarked to be related to this which I believe is incorrect. Similar to that bug, I do not believe this is related to the request in bug #10327 (allowing a single query to reference/open a TEMP table more than once). I believe this is because he created the temp table OUTSIDE of the function. ![]() In that bug, the OP did not alias the table, but still got the error. The above manual entry was cased in bug #60718, which I believe is a similar issue. However, in my experience, it only seems to be thrown if the TEMPORARY TABLE is created before the function is invoked. However, error 1137 ("Can't reopen table") is thrown when a stored procedure attempts to open a temporary table (without aliases). This implies that if aliases are not used, a temporary table can be referenced more than once in stored functions. ![]() This error also occurs if you refer to a temporary table multiple times in a stored function under different aliases, even if the references occur in different statements within the function." Mysql> SELECT * FROM temp_table, temp_table AS t2 ĮRROR 1137: Can't reopen table: 'temp_table' For example, the following does not work: "- You cannot refer to a TEMPORARY table more than once in the same query.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |