summaryrefslogtreecommitdiff
path: root/sql/sql_help.cc
diff options
context:
space:
mode:
authortimour@mysql.com <>2005-08-12 17:57:19 +0300
committertimour@mysql.com <>2005-08-12 17:57:19 +0300
commita247282aa6270e809f4ad3f5205dc79ca7be8ec0 (patch)
tree98cc5c366d6eaba9f415323933356e53cf8d3a92 /sql/sql_help.cc
parent2889025accafd9f7a5c7b2788b9e34f31dc257e4 (diff)
downloadmariadb-git-a247282aa6270e809f4ad3f5205dc79ca7be8ec0.tar.gz
Implementation of WL#2486 -
"Process NATURAL and USING joins according to SQL:2003". * Some of the main problems fixed by the patch: - in "select *" queries the * expanded correctly according to ANSI for arbitrary natural/using joins - natural/using joins are correctly transformed into JOIN ... ON for any number/nesting of the joins. - column references are correctly resolved against natural joins of any nesting and combined with arbitrary other joins. * This patch also contains a fix for name resolution of items inside the ON condition of JOIN ... ON - in this case items must be resolved only against the JOIN operands. To support such 'local' name resolution, the patch introduces a stack of name resolution contexts used at parse time. NOTICE: - This patch is not complete in the sense that - there are 2 test cases that still do not pass - one in join.test, one in select.test. Both are marked with a comment "TODO: WL#2486". - it does not include a new test specific for the task
Diffstat (limited to 'sql/sql_help.cc')
-rw-r--r--sql/sql_help.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_help.cc b/sql/sql_help.cc
index 6780beec258..0a89c3a29d7 100644
--- a/sql/sql_help.cc
+++ b/sql/sql_help.cc
@@ -75,7 +75,7 @@ enum enum_used_fields
RETURN VALUES
0 all ok
- 1 one of the fileds didn't finded
+ 1 one of the fileds was not found
*/
static bool init_fields(THD *thd, TABLE_LIST *tables,
@@ -90,7 +90,7 @@ static bool init_fields(THD *thd, TABLE_LIST *tables,
Item_field *field= new Item_field(context,
"mysql", find_fields->table_name,
find_fields->field_name);
- if (!(find_fields->field= find_field_in_tables(thd, field, tables,
+ if (!(find_fields->field= find_field_in_tables(thd, field, tables, NULL,
0, REPORT_ALL_ERRORS, 1,
TRUE)))
DBUG_RETURN(1);
@@ -631,12 +631,15 @@ bool mysqld_help(THD *thd, const char *mask)
tables[0].alias= tables[0].table_name= (char*) "help_topic";
tables[0].lock_type= TL_READ;
tables[0].next_global= tables[0].next_local= &tables[1];
+ tables[0].next_name_resolution_table= tables[0].next_local;
tables[1].alias= tables[1].table_name= (char*) "help_category";
tables[1].lock_type= TL_READ;
tables[1].next_global= tables[1].next_local= &tables[2];
+ tables[1].next_name_resolution_table= tables[1].next_local;
tables[2].alias= tables[2].table_name= (char*) "help_relation";
tables[2].lock_type= TL_READ;
tables[2].next_global= tables[2].next_local= &tables[3];
+ tables[2].next_name_resolution_table= tables[2].next_local;
tables[3].alias= tables[3].table_name= (char*) "help_keyword";
tables[3].lock_type= TL_READ;
tables[0].db= tables[1].db= tables[2].db= tables[3].db= (char*) "mysql";
@@ -655,6 +658,7 @@ bool mysqld_help(THD *thd, const char *mask)
tables do not contain VIEWs => we can pass 0 as conds
*/
setup_tables(thd, &thd->lex->select_lex.context,
+ &thd->lex->select_lex.top_join_list,
tables, 0, &leaves, FALSE);
memcpy((char*) used_fields, (char*) init_used_fields, sizeof(used_fields));
if (init_fields(thd, tables, used_fields, array_elements(used_fields)))