mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
merge
This commit is contained in:
@ -1238,3 +1238,11 @@ CREATE TABLE t1
|
|||||||
s2 CHAR(5) COLLATE latin1_swedish_ci);
|
s2 CHAR(5) COLLATE latin1_swedish_ci);
|
||||||
SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1);
|
SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1);
|
||||||
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
|
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '='
|
||||||
|
drop table t1;
|
||||||
|
create table t1 (s1 int);
|
||||||
|
create table t2 (s1 int);
|
||||||
|
insert into t1 values (1);
|
||||||
|
insert into t2 values (1);
|
||||||
|
select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1);
|
||||||
|
s1
|
||||||
|
drop table t1,t2;
|
||||||
|
@ -807,6 +807,7 @@ INSERT INTO t1 VALUES("2f6161e879db43c1a5b82c21ddc49089", "Default", "System", "
|
|||||||
INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
|
INSERT INTO t1 VALUES("c373e9f5ad0791724315444553544200", "AddDocumentTest", "admin", "2003-06-09 10:51:25", "Movie Reviews", "0", "2003-06-09 10:51:25", "admin", "0", "2f6161e879db43c1a5b82c21ddc49089", "03eea05112b845949f3fd03278b5fe43", NULL);
|
||||||
SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
|
SELECT 'c373e9f5ad0791a0dab5444553544200' IN(SELECT t1.FOLDERID FROM t1 WHERE t1.PARENTID='2f6161e879db43c1a5b82c21ddc49089' AND t1.FOLDERNAME = 'Level1');
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
#
|
#
|
||||||
# alloc_group_fields() working
|
# alloc_group_fields() working
|
||||||
#
|
#
|
||||||
@ -829,3 +830,14 @@ CREATE TABLE t1
|
|||||||
s2 CHAR(5) COLLATE latin1_swedish_ci);
|
s2 CHAR(5) COLLATE latin1_swedish_ci);
|
||||||
--error 1265
|
--error 1265
|
||||||
SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1);
|
SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1);
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# aggregate functions in HAVING test
|
||||||
|
#
|
||||||
|
create table t1 (s1 int);
|
||||||
|
create table t2 (s1 int);
|
||||||
|
insert into t1 values (1);
|
||||||
|
insert into t2 values (1);
|
||||||
|
select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1);
|
||||||
|
drop table t1,t2;
|
||||||
|
13
sql/item.cc
13
sql/item.cc
@ -49,15 +49,19 @@ Item::Item():
|
|||||||
THD *thd= current_thd;
|
THD *thd= current_thd;
|
||||||
next= thd->free_list; // Put in free list
|
next= thd->free_list; // Put in free list
|
||||||
thd->free_list= this;
|
thd->free_list= this;
|
||||||
loop_id= 0;
|
|
||||||
/*
|
/*
|
||||||
Item constructor can be called during execution other tnen SQL_COM
|
Item constructor can be called during execution other tnen SQL_COM
|
||||||
command => we should check thd->lex.current_select on zero (thd->lex
|
command => we should check thd->lex.current_select on zero (thd->lex
|
||||||
can be uninitialised)
|
can be uninitialised)
|
||||||
*/
|
*/
|
||||||
if (thd->lex.current_select &&
|
if (thd->lex.current_select)
|
||||||
thd->lex.current_select->parsing_place == SELECT_LEX_NODE::SELECT_LIST)
|
{
|
||||||
thd->lex.current_select->select_items++;
|
SELECT_LEX_NODE::enum_parsing_place place=
|
||||||
|
thd->lex.current_select->parsing_place;
|
||||||
|
if (place == SELECT_LEX_NODE::SELECT_LIST ||
|
||||||
|
place == SELECT_LEX_NODE::IN_HAVING)
|
||||||
|
thd->lex.current_select->select_n_having_items++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -66,7 +70,6 @@ Item::Item():
|
|||||||
tables
|
tables
|
||||||
*/
|
*/
|
||||||
Item::Item(THD *thd, Item &item):
|
Item::Item(THD *thd, Item &item):
|
||||||
loop_id(0),
|
|
||||||
str_value(item.str_value),
|
str_value(item.str_value),
|
||||||
name(item.name),
|
name(item.name),
|
||||||
max_length(item.max_length),
|
max_length(item.max_length),
|
||||||
|
@ -83,7 +83,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class Item {
|
class Item {
|
||||||
uint loop_id; /* Used to find selfrefering loops */
|
|
||||||
Item(const Item &); /* Prevent use of these */
|
Item(const Item &); /* Prevent use of these */
|
||||||
void operator=(Item &);
|
void operator=(Item &);
|
||||||
public:
|
public:
|
||||||
|
@ -508,7 +508,7 @@ void Item_in_subselect::single_value_transformer(THD *thd,
|
|||||||
{
|
{
|
||||||
sl->item_list.push_back(item);
|
sl->item_list.push_back(item);
|
||||||
setup_ref_array(thd, &sl->ref_pointer_array,
|
setup_ref_array(thd, &sl->ref_pointer_array,
|
||||||
1 + sl->select_items +
|
1 + sl->select_n_having_items +
|
||||||
sl->order_list.elements + sl->group_list.elements);
|
sl->order_list.elements + sl->group_list.elements);
|
||||||
// To prevent crash on Item_ref_null_helper destruction in case of error
|
// To prevent crash on Item_ref_null_helper destruction in case of error
|
||||||
sl->ref_pointer_array[0]= 0;
|
sl->ref_pointer_array[0]= 0;
|
||||||
|
@ -126,7 +126,8 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
|
|||||||
item_list= select_cursor->item_list;
|
item_list= select_cursor->item_list;
|
||||||
select_cursor->with_wild= 0;
|
select_cursor->with_wild= 0;
|
||||||
if (setup_ref_array(thd, &select_cursor->ref_pointer_array,
|
if (setup_ref_array(thd, &select_cursor->ref_pointer_array,
|
||||||
(item_list.elements + select_cursor->select_items +
|
(item_list.elements +
|
||||||
|
select_cursor->select_n_having_items +
|
||||||
select_cursor->order_list.elements +
|
select_cursor->order_list.elements +
|
||||||
select_cursor->group_list.elements)) ||
|
select_cursor->group_list.elements)) ||
|
||||||
setup_fields(thd, select_cursor->ref_pointer_array, first_table,
|
setup_fields(thd, select_cursor->ref_pointer_array, first_table,
|
||||||
|
@ -959,7 +959,7 @@ void st_select_lex_node::init_select()
|
|||||||
order_list.next= (byte**) &order_list.first;
|
order_list.next= (byte**) &order_list.first;
|
||||||
select_limit= HA_POS_ERROR;
|
select_limit= HA_POS_ERROR;
|
||||||
offset_limit= 0;
|
offset_limit= 0;
|
||||||
select_items= 0;
|
select_n_having_items= 0;
|
||||||
with_sum_func= 0;
|
with_sum_func= 0;
|
||||||
parsing_place= SELECT_LEX_NODE::NO_MATTER;
|
parsing_place= SELECT_LEX_NODE::NO_MATTER;
|
||||||
}
|
}
|
||||||
|
@ -205,8 +205,12 @@ public:
|
|||||||
ha_rows select_limit, offset_limit; /* LIMIT clause parameters */
|
ha_rows select_limit, offset_limit; /* LIMIT clause parameters */
|
||||||
// Arrays of pointers to top elements of all_fields list
|
// Arrays of pointers to top elements of all_fields list
|
||||||
Item **ref_pointer_array;
|
Item **ref_pointer_array;
|
||||||
|
/*
|
||||||
uint select_items; /* number of items in select_list */
|
number of items in select_list and HAVING clause used to get number
|
||||||
|
bigger then can be number of entries that will be added to all item
|
||||||
|
list during split_sum_func
|
||||||
|
*/
|
||||||
|
uint select_n_having_items;
|
||||||
uint cond_count; /* number of arguments of and/or/xor in where/having */
|
uint cond_count; /* number of arguments of and/or/xor in where/having */
|
||||||
enum_parsing_place parsing_place; /* where we are parsing expression */
|
enum_parsing_place parsing_place; /* where we are parsing expression */
|
||||||
bool with_sum_func; /* sum function indicator */
|
bool with_sum_func; /* sum function indicator */
|
||||||
|
@ -294,7 +294,8 @@ JOIN::prepare(Item ***rref_pointer_array,
|
|||||||
fields_list,
|
fields_list,
|
||||||
&all_fields, wild_num))) ||
|
&all_fields, wild_num))) ||
|
||||||
setup_ref_array(thd, rref_pointer_array, (fields_list.elements +
|
setup_ref_array(thd, rref_pointer_array, (fields_list.elements +
|
||||||
select_lex->select_items +
|
select_lex->
|
||||||
|
select_n_having_items +
|
||||||
og_num)) ||
|
og_num)) ||
|
||||||
setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1,
|
setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1,
|
||||||
&all_fields, 1) ||
|
&all_fields, 1) ||
|
||||||
|
@ -159,7 +159,8 @@ int st_select_lex_unit::prepare(THD *thd, select_result *sel_result,
|
|||||||
item_list= select_cursor->item_list;
|
item_list= select_cursor->item_list;
|
||||||
select_cursor->with_wild= 0;
|
select_cursor->with_wild= 0;
|
||||||
if (setup_ref_array(thd, &select_cursor->ref_pointer_array,
|
if (setup_ref_array(thd, &select_cursor->ref_pointer_array,
|
||||||
(item_list.elements + select_cursor->select_items +
|
(item_list.elements +
|
||||||
|
select_cursor->select_n_having_items +
|
||||||
select_cursor->order_list.elements +
|
select_cursor->order_list.elements +
|
||||||
select_cursor->group_list.elements)) ||
|
select_cursor->group_list.elements)) ||
|
||||||
setup_fields(thd, select_cursor->ref_pointer_array, first_table,
|
setup_fields(thd, select_cursor->ref_pointer_array, first_table,
|
||||||
|
Reference in New Issue
Block a user