1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

WL#1972 "Evaluate HAVING before SELECT select-list"

- Changed name resolution for GROUP BY so that derived columns do not shadow table columns
  from the FROM clause. As a result GROUP BY now is handled as a true ANSI extentsion.
- Issue a warning when HAVING is resolved into ambiguous columns, and prefer the columns from
  the GROUP BY clause over SELECT columns.


mysql-test/r/having.result:
  Correct result for updated GROUP BY name resolution.
sql/item.cc:
  - prefer GROUP columns, but if none is found use SELECT list
  - issue a waring when a field may be resolved ambiguously
  - more/fixed comments
sql/mysql_priv.h:
  More flexible find_field_in_tables().
sql/sp.cc:
  More flexible find_field_in_tables().
sql/sql_base.cc:
  More flexible find_field_in_tables().
sql/sql_help.cc:
  More flexible find_field_in_tables().
sql/sql_select.cc:
  - name resolution of GROUP/ORDER BY column references is differentiated:
    - GROUP BY is resolved in SELECT and FROM clauses
    - ORDER BY is resolved only in SELECT (as before)
  - more informative variable names
  - more comments
This commit is contained in:
unknown
2004-11-02 18:23:15 +02:00
parent 637c08d7cc
commit 048d731a31
7 changed files with 171 additions and 75 deletions

View File

@ -88,7 +88,7 @@ static bool init_fields(THD *thd, TABLE_LIST *tables,
Item_field *field= new Item_field("mysql", find_fields->table_name,
find_fields->field_name);
if (!(find_fields->field= find_field_in_tables(thd, field, tables,
0, TRUE, 1)))
0, REPORT_ALL_ERRORS, 1)))
DBUG_RETURN(1);
}
DBUG_RETURN(0);