-
igor@rurik.mysql.com authored
Fixed bug #12382. INSERT statement effectively changed thd->set_query_id to 0, while SELECT statement changed it to 0. As a result the insert_fields function that expanded '*' was called with different values of thd->set_query_id for the query SELECT * FROM view depending on whether it was run after an INSERT or after a SELECT statement. This was corrected by restoring the old value of thd->set_query_id when returning from the function setup_fields where possible reset could occur. If the value of thd->set_query_id == 0 then the fields substituted instead of '*' were not registered as used for bitmaps used_keys. This caused selection of an invalid execution plan for the query SELECT * from <view>. view.result, view.test: Added a test case for bug #12382.
0aff8a13