mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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. mysql-test/r/ps.result: Test results fixed: the test case for Bug#6050 mysql-test/r/ps_1general.result: Test results fixed: in prepared statements we expand '*' to a list of fully qualified fields (db.table.column). mysql-test/t/ps.test: A test for Bug#6050 "EXECUTE stmt reports ambiguous fieldnames with ident. tables fr. diff. schemata" sql/item.cc: Revise all Item_field constructors: we need to make sure that no Item_field object points to unaccessible memory in prepared statements. sql/item.h: Revise all Item_field constructors: we need to make sure that no Item_field object points to unaccessible memory in prepared statements. sql/sql_base.cc: Item_field use changed to be prepared statements friendly. sql/sql_class.h: New check of Item_arena state. sql/sql_union.cc: Fixing the problem with name resolving in UNION and prepared statements: In case of SELECT a, b, c FROM t1 UNION SELECT a, b, c FROM t2 the list of selected items is represented as a List<Item_field>, where each Item_field points to a field of temporary table. But the temporary table is created anew on each execution of the prepared statement. So on each subsequent execution we should reset Item_field items to point to fields from freshly-created temporary table. sql/table.h: Comment TABLE member.
This commit is contained in:
@ -2655,8 +2655,8 @@ int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds)
|
||||
strlen(t1_field_name), 0, 0,
|
||||
¬_used_field_index)))
|
||||
{
|
||||
Item_func_eq *tmp=new Item_func_eq(new Item_field(*t1_field),
|
||||
new Item_field(t2_field));
|
||||
Item_func_eq *tmp=new Item_func_eq(new Item_field(thd, *t1_field),
|
||||
new Item_field(thd, t2_field));
|
||||
if (!tmp)
|
||||
goto err;
|
||||
/* Mark field used for table cache */
|
||||
|
Reference in New Issue
Block a user