Bug #6050 EXECUTEstmt reports ambiguous fieldnames with ident. tables fr. diff. schemata
Submitted: 12 Oct 2004 18:16 Modified: 22 Oct 2004 11:02
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:>= 4.1 OS:Linux (Linux)
Assigned to: Konstantin Osipov CPU Architecture:Any

[12 Oct 2004 18:16] Georg Richter
Description:
When using a join statement with two identical tables, but from different schemata, execute 
statement reports an error: Column 'xxx' in field list is ambiguous 

How to repeat:
4.1.5-gamma-debug-log 
[20:01] root@test> create table test.t1 (a int); 
Query OK, 0 rows affected (0.08 sec) 
 
4.1.5-gamma-debug-log 
[20:01] root@test> create table test1.t1 (a int); 
Query OK, 0 rows affected (0.06 sec) 
 
4.1.5-gamma-debug-log 
[20:02] root@test> SELECT * FROM test.t1, test1.t1; 
Empty set (0.00 sec) 
 
4.1.5-gamma-debug-log 
[20:01] root@test> PREPARE my_stmt FROM 'SELECT * FROM test.t1, test1.t1'; 
Query OK, 0 rows affected (0.00 sec) 
Statement prepared 
 
4.1.5-gamma-debug-log 
[20:02] root@test> EXECUTE my_stmt; 
ERROR 1052 (23000): Column 't1.a' in field list is ambiguous 
 

Suggested fix:
[12 Oct 2004 20:09] MySQL Verification Team
Verified on latest BK 4.1 source tree.
[21 Oct 2004 22:28] Konstantin Osipov
ChangeSet
  1.2105 04/10/22 02:25:55 konstantin@mysql.com +8 -0
  A fix and test case for Bug#6050 "EXECUTE stmt reports ambiguous field
  names with ident. tables fr. diff. schemata": revise all uses of
  Item_field and make them prepared-statements friendly when necessary.
[22 Oct 2004 11:02] Konstantin Osipov
Fixed in 4.1.7