summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
authorgkodinov/kgeorge@macbook.gmz <>2007-02-19 14:39:37 +0200
committergkodinov/kgeorge@macbook.gmz <>2007-02-19 14:39:37 +0200
commitd17ad7b3a40e23d08bc8398dda5d784cbb988b59 (patch)
treecf74708b8339ba17919b8f5210fe226d74f16433 /sql/item.h
parent4908cf0772166d3b93297601265ba52f34bca7f2 (diff)
downloadmariadb-git-d17ad7b3a40e23d08bc8398dda5d784cbb988b59.tar.gz
Bug #25831: Deficiencies in INSERT ... SELECT ... field name resolving.
Several problems fixed: 1. There was a "catch-all" context initialization in setup_tables() that was causing the table that we insert into to be visible in the SELECT part of an INSERT .. SELECT .. statement with no tables in its FROM clause. This was making sure all the under-initialized contexts in various parts of the code are not left uninitialized. Fixed by removing the "catch-all" statement and initializing the context in the parser. 2. Incomplete name resolution context when resolving the right-hand values in the ON DUPLICATE KEY UPDATE ... part of an INSERT ... SELECT ... caused columns from NATURAL JOIN/JOIN USING table references in the FROM clause of the select to be unavailable. Fixed by establishing a proper name resolution context. 3. When setting up the special name resolution context for problem 2 there was no check for cases where an aggregate function without a GROUP BY effectively takes the column from the SELECT part of an INSERT ... SELECT unavailable for ON DUPLICATE KEY UPDATE. Fixed by checking for that condition when setting up the name resolution context.
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sql/item.h b/sql/item.h
index 62d6127f10b..e6be2f223da 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -325,10 +325,10 @@ private:
TABLE_LIST *save_first_name_resolution_table;
TABLE_LIST *save_next_name_resolution_table;
bool save_resolve_in_select_list;
+ TABLE_LIST *save_next_local;
public:
Name_resolution_context_state() {} /* Remove gcc warning */
- TABLE_LIST *save_next_local;
public:
/* Save the state of a name resolution context. */
@@ -355,6 +355,11 @@ public:
next_name_resolution_table= save_next_name_resolution_table;
context->resolve_in_select_list= save_resolve_in_select_list;
}
+
+ TABLE_LIST *get_first_name_resolution_table()
+ {
+ return save_first_name_resolution_table;
+ }
};
/*************************************************************************/