mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
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
This commit is contained in:
@@ -338,7 +338,7 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
/* Check that all tables, fields, conds and order are ok */
|
||||
|
||||
if ((!(select_options & OPTION_SETUP_TABLES_DONE) &&
|
||||
setup_tables(thd, &select_lex->context,
|
||||
setup_tables(thd, &select_lex->context, join_list,
|
||||
tables_list, &conds, &select_lex->leaf_tables,
|
||||
FALSE)) ||
|
||||
setup_wild(thd, tables_list, fields_list, &all_fields, wild_num) ||
|
||||
@@ -11881,13 +11881,14 @@ cp_buffer_from_ref(THD *thd, TABLE_REF *ref)
|
||||
|
||||
SYNOPSIS
|
||||
find_order_in_list()
|
||||
thd Pointer to current thread structure
|
||||
ref_pointer_array All select, group and order by fields
|
||||
tables List of tables to search in (usually FROM clause)
|
||||
order Column reference to be resolved
|
||||
fields List of fields to search in (usually SELECT list)
|
||||
all_fields All select, group and order by fields
|
||||
is_group_field True if order is a GROUP field, false if ORDER by field
|
||||
thd [in] Pointer to current thread structure
|
||||
ref_pointer_array [in/out] All select, group and order by fields
|
||||
tables [in] List of tables to search in (usually FROM clause)
|
||||
order [in] Column reference to be resolved
|
||||
fields [in] List of fields to search in (usually SELECT list)
|
||||
all_fields [in/out] All select, group and order by fields
|
||||
is_group_field [in] True if order is a GROUP field, false if
|
||||
ORDER by field
|
||||
|
||||
DESCRIPTION
|
||||
Given a column reference (represented by 'order') from a GROUP BY or ORDER
|
||||
@@ -11963,7 +11964,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
|
||||
order_item_type == Item::REF_ITEM)
|
||||
{
|
||||
from_field= find_field_in_tables(thd, (Item_ident*) order_item, tables,
|
||||
&view_ref, IGNORE_ERRORS, TRUE,
|
||||
NULL, &view_ref, IGNORE_ERRORS, TRUE,
|
||||
FALSE);
|
||||
if (!from_field)
|
||||
from_field= (Field*) not_found_field;
|
||||
|
||||
Reference in New Issue
Block a user