| Bug #33811 | Call to stored procedure with SELECT * / RIGHT JOIN fails after the first time | ||
|---|---|---|---|
| Submitted: | 11 Jan 0:07 | Modified: | 9 Apr 14:45 |
| Reporter: | Trent Lloyd | ||
| Status: | Patch pending | ||
| Category: | Server: DML | Severity: | S3 (Non-critical) |
| Version: | 5.0/5.1/6.0 | OS: | Any |
| Assigned to: | Georgi Kodinov | Target Version: | 5.0+ |
| Triage: | Triaged: D3 (Medium) / R3 (Medium) / E3 (Medium) | ||
[27 Feb 15:36]
Konstantin Osipov
DML reexecution bug, reassigning to the right lead.
[9 Apr 14:45]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/45124 ChangeSet@1.2599, 2008-04-09 15:44:27+03:00, gkodinov@magare.gmz +4 -0 Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN fails after the first time Two separate problems : 1. When flattening joins the linked list used for name resolution (next_name_resolution_table) was not updated. Fixed by updating the pointers when extending the table list 2. The items created by expanding a * (star) as a column reference were marked as fixed, but no cached table was assigned to them (unlike what Item_field::fix_fields does). Fixed by assigning a cached table (so the re-preparation is done faster). Note that the fix for #2 hides the fix for #1 in most cases (except when a table reference cannot be cached).

Description: When using a stored procedure with a RIGHT JOIN, the second execution always fails with an unknown column error when using SELECT * but not with specific column names. How to repeat: Test Case: DROP DATABASE IF EXISTS test_f507e4; CREATE DATABASE test_f507e4; USE test_f507e4; CREATE TABLE t1 (id INT PRIMARY KEY auto_increment); CREATE TABLE t2 (id INT PRIMARY KEY auto_increment, t1_id INT); DELIMITER $$ DROP PROCEDURE IF EXISTS `test_sp`$$ CREATE PROCEDURE `test_sp`() BEGIN SELECT * FROM t1 RIGHT JOIN t2 ON t1.id=t2.t1_id; END$$ DELIMITER ; CALL test_sp(); CALL test_sp();