[MDEV-20096] Stored Procedure returns “Error Code: 1054. Unknown column 'schema.table.col' in 'field list'” when Creating different temporary table on same session Created: 2019-07-18 Updated: 2023-04-27 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Prepared Statements |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Kevin Harrison | Assignee: | Dmitry Shulga |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | Compatibility, SQL, innodb | ||
| Environment: |
MariaDB 10.3 and 10.1.21, using MySQL Workbench 6.3.10 and HeidiSQL 9.4.0 |
||
| Attachments: |
|
| Description |
|
When using a stored procedure to dynamically generate a table based on configuration and return a result set (SELECT) with the records in that table, the second call to that procedure to generate a different table structure returns no records and it reports a missing column from a previous temporary table of the same name. I tried this with MariaDB 10.3 and 10.1.21 and received the same result. I have minimized my code here to the minimum to demonstrate the error after trying several variations of single and multiple sub-procedures. I also tried using some transaction control with COMMITS after executing the process, before trying to start the process with a different parameter, but got the same results. I would expect that I can pass a parameter to a stored procedure to generate a temporary table, and return the records of that temporary table. Even if I call that same procedure multiple times with different parameters on the same session. The actual results are that when the stored procedure is called to generate the temporary table with a different table structure, it returns this error complaining about the column missing from the temporary table created in the previous invocation of that same stored procedure. Error Code: 1054. Unknown column 'mySchema.aTable.the_column' in 'field list' The only way I have found to prevent this error is a. ending the jdbc connection and ending the server session b. recompiling one of the stored procedures in the call stack Recompiling is not viable. And ending the session seems unreasonable. This seems like a defect. But would be interested to find if there is some way to get this to work.
user from stackoverflow.com suggested a work-around is to use EXECUTE IMMEDIATE in GetATable2 (untested by me, yet) |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2019-07-18 ] | ||||||||||||||||||||||||
|
Moved to MariaDB Server. This doesn't look like it is a ColumnStore issue. | ||||||||||||||||||||||||
| Comment by Kevin Harrison [ 2019-07-18 ] | ||||||||||||||||||||||||
|
That is odd. I am pretty sure when I created the JIRA item I identified the component or some other thing as MariaDB Server. Also, I did verify that EXECUTE IMMEDIATE is a valid work around. And changed priority from Major to Minor. | ||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2019-07-22 ] | ||||||||||||||||||||||||
|
Thanks for the report! Reproduced as described on 5.5-10.4 with MyIsam/Innodb, both with
|