diff options
author | gkodinov/kgeorge@macbook.gmz <> | 2007-02-19 14:39:37 +0200 |
---|---|---|
committer | gkodinov/kgeorge@macbook.gmz <> | 2007-02-19 14:39:37 +0200 |
commit | d17ad7b3a40e23d08bc8398dda5d784cbb988b59 (patch) | |
tree | cf74708b8339ba17919b8f5210fe226d74f16433 /sql/item.h | |
parent | 4908cf0772166d3b93297601265ba52f34bca7f2 (diff) | |
download | mariadb-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.h | 7 |
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; + } }; /*************************************************************************/ |