mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-sum-4.1 sql/item.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_select.cc: Auto merged
This commit is contained in:
commit
3b4c38336d
6 changed files with 24 additions and 12 deletions
|
@ -1966,5 +1966,13 @@ howmanyvalues mycount
|
|||
3 3
|
||||
4 4
|
||||
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
|
||||
ERROR 42S22: Unknown column 'a.avalue' in 'where clause'
|
||||
howmanyvalues mycount
|
||||
1 1
|
||||
2 1
|
||||
3 1
|
||||
4 1
|
||||
drop table t1;
|
||||
create table t1 (x int);
|
||||
select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
|
||||
(select b.x from t1 as b where b.x=a.x)
|
||||
drop table t1;
|
||||
|
|
|
@ -1264,6 +1264,9 @@ SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.how
|
|||
CREATE INDEX t1_howmanyvalues_idx ON t1 (howmanyvalues);
|
||||
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues+1 = a.howmanyvalues+1) as mycount from t1 a group by a.howmanyvalues;
|
||||
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.howmanyvalues) as mycount from t1 a group by a.howmanyvalues;
|
||||
-- error 1054
|
||||
SELECT a.howmanyvalues, (SELECT count(*) from t1 b where b.howmanyvalues = a.avalue) as mycount from t1 a group by a.howmanyvalues;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (x int);
|
||||
select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
|
||||
drop table t1;
|
||||
|
|
10
sql/item.cc
10
sql/item.cc
|
@ -1271,11 +1271,10 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||
prev_subselect_item->parsing_place;
|
||||
/*
|
||||
check table fields only if subquery used somewhere out of HAVING
|
||||
or SELECT list or outer SELECT do not use groupping (i.e. tables
|
||||
are accessable)
|
||||
or outer SELECT do not use groupping (i.e. tables are
|
||||
accessable)
|
||||
*/
|
||||
if (((place != IN_HAVING &&
|
||||
place != SELECT_LIST) ||
|
||||
if ((place != IN_HAVING ||
|
||||
(sl->with_sum_func == 0 && sl->group_list.elements == 0)) &&
|
||||
(tmp= find_field_in_tables(thd, this,
|
||||
table_list, &where,
|
||||
|
@ -1954,8 +1953,7 @@ bool Item_ref::fix_fields(THD *thd,TABLE_LIST *tables, Item **reference)
|
|||
or SELECT list or outer SELECT do not use groupping (i.e. tables
|
||||
are accessable)
|
||||
*/
|
||||
if (((place != IN_HAVING &&
|
||||
place != SELECT_LIST) ||
|
||||
if ((place != IN_HAVING ||
|
||||
(sl->with_sum_func == 0 && sl->group_list.elements == 0)) &&
|
||||
(tmp= find_field_in_tables(thd, this,
|
||||
table_list, &where,
|
||||
|
|
|
@ -934,9 +934,6 @@ Item_in_subselect::row_value_transformer(JOIN *join)
|
|||
}
|
||||
|
||||
select_lex->uncacheable|= UNCACHEABLE_DEPENDENT;
|
||||
select_lex->setup_ref_array(thd,
|
||||
select_lex->order_list.elements +
|
||||
select_lex->group_list.elements);
|
||||
{
|
||||
uint n= left_expr->cols();
|
||||
List_iterator_fast<Item> li(select_lex->item_list);
|
||||
|
|
|
@ -2142,8 +2142,12 @@ find_item_in_list(Item *find, List<Item> &items, uint *counter,
|
|||
case sensitive.
|
||||
In cases where they are not case sensitive, they are always in lower
|
||||
case.
|
||||
|
||||
item_field->field_name and item_field->table_name can be 0x0 if
|
||||
item is not fix fielded yet.
|
||||
*/
|
||||
if (!my_strcasecmp(system_charset_info, item_field->field_name,
|
||||
if (item_field->field_name && item_field->table_name &&
|
||||
!my_strcasecmp(system_charset_info, item_field->field_name,
|
||||
field_name) &&
|
||||
!strcmp(item_field->table_name, table_name) &&
|
||||
(!db_name || (item_field->db_name &&
|
||||
|
|
|
@ -8465,6 +8465,8 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
|
|||
}
|
||||
}
|
||||
else if ((pos->type() == Item::FUNC_ITEM ||
|
||||
pos->type() == Item::SUBSELECT_ITEM ||
|
||||
pos->type() == Item::CACHE_ITEM ||
|
||||
pos->type() == Item::COND_ITEM) &&
|
||||
!pos->with_sum_func)
|
||||
{ // Save for send fields
|
||||
|
|
Loading…
Reference in a new issue