[ODBC-159] Creation of temporary tables with multiple statements in one query fails. Created: 2018-07-10 Updated: 2018-08-03 Resolved: 2018-07-27 |
|
| Status: | Closed |
| Project: | MariaDB Connector/ODBC |
| Component/s: | General |
| Affects Version/s: | 3.0.5 |
| Fix Version/s: | 3.0.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Patrick Dudziak | Assignee: | Lawrin Novitsky |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MariaDB 10.2.13 on FreeBSD 11.1, Client Windows 10 with ODBC Connector 3.0.5 |
||
| Attachments: |
|
| Description |
|
We are having issues with the creation of temporary tables through the MariaDB ODBC Connector. The statements we are issuing:
We execute these statements in a single query like so:
The error we get is: However if we execute this in multiple queries it does work. Like so:
Is there a bug concering multiple statements in a single query and temporary tables? Both versions do work with the mysql connector. I have also attached the general logfile for the case when the command fails. Like always i am happy to provide more information on this as needed. |
| Comments |
| Comment by Lawrin Novitsky [ 2018-07-10 ] |
|
Thank you for your report! |
| Comment by Lawrin Novitsky [ 2018-07-13 ] |
|
Ok, everything is fine here with the parsing. The reason for the error is simple, and could be guessed from the error's text. Everything is prepared before been executed. And thus SELECT * FROM _temp_statistics is prepared when table does not exist, i.e. CREATE TEMPORARY TABLE _temp_statistics AS (SELECT * FROM INFORMATION_SCHEMA.STATISTICS) has only been prepared, and not executed. |
| Comment by Patrick Dudziak [ 2018-07-19 ] |
|
Thank you for your hard work. We really appreciate the insight you shared with us. |
| Comment by Lawrin Novitsky [ 2018-07-19 ] |
|
I actually planned to include the fix in the coming release, if I have time for it. I've already started work on it. But as of 3.0.5, you could send DROP in CREATE as a batch, and SELECT separately. In this case connector will send DROP and CREATE together. I am plan to make connector to do that automatically - e.g. split your multistatement query into 2 DROP+CREATE, and SELECT |
| Comment by Lawrin Novitsky [ 2018-07-27 ] |
|
I've decided to push only fiex for SQLExecDirect case without optimization I was talking about |