Commit 5dbffdb2 authored by unknown's avatar unknown

Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt

into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
parents a8868f6e fe8dfab5
......@@ -937,4 +937,19 @@ SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1;
GROUP_CONCAT(DISTINCT b, a ORDER BY b)
11,22,32
DROP TABLE t1, t2, t3;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (),();
SELECT s1.d1 FROM
(
SELECT
t1.a as d1,
GROUP_CONCAT(DISTINCT t1.a) AS d2
FROM
t1 AS t1,
t1 AS t2
GROUP BY 1
) AS s1;
d1
NULL
DROP TABLE t1;
End of 5.0 tests
......@@ -434,3 +434,12 @@ SELECT @x;
@x
99
DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1);
SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
ROW(a, 1) IN (SELECT SUM(b), 1)
1
SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
ROW(a, 1) IN (SELECT SUM(b), 3)
0
DROP TABLE t1;
......@@ -4155,6 +4155,41 @@ SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1;
0
0
DROP TABLE t1, t2;
create table t1(a int,b int,key(a),key(b));
insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
(6,7),(7,4),(5,3);
5
4
3
2
1
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
drop table t1;
CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5));
INSERT INTO t1 VALUES (0x41,0x41), (0x42,0x42), (0x43,0x43);
SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1);
......
......@@ -640,4 +640,21 @@ SELECT GROUP_CONCAT(DISTINCT b, a ORDER BY b) FROM t1;
DROP TABLE t1, t2, t3;
#
# Bug #34747: crash in debug assertion check after derived table
#
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (),();
SELECT s1.d1 FROM
(
SELECT
t1.a as d1,
GROUP_CONCAT(DISTINCT t1.a) AS d2
FROM
t1 AS t1,
t1 AS t2
GROUP BY 1
) AS s1;
DROP TABLE t1;
--echo End of 5.0 tests
......@@ -224,3 +224,16 @@ SET @x:= (SELECT h FROM t1 WHERE (a,b,c,d,e,f,g)=(1,2,3,4,5,6,7));
SELECT @x;
DROP TABLE t1;
#
# Bug #34620: item_row.cc:50: Item_row::illegal_method_call(const char*):
# Assertion `0' failed
#
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1);
SELECT ROW(a, 1) IN (SELECT SUM(b), 1) FROM t1 GROUP BY a;
SELECT ROW(a, 1) IN (SELECT SUM(b), 3) FROM t1 GROUP BY a;
DROP TABLE t1;
......@@ -3015,6 +3015,52 @@ INSERT INTO t2 VALUES (103, 203);
SELECT ((a1,a2) IN (SELECT * FROM t2 WHERE b2 > 0)) IS NULL FROM t1;
DROP TABLE t1, t2;
#
# Bug31048: Many nested subqueries may cause server crash.
#
create table t1(a int,b int,key(a),key(b));
insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
(6,7),(7,4),(5,3);
let $nesting= 26;
let $should_work_nesting= 5;
let $start= select sum(a),a from t1 where a> ( select sum(a) from t1 ;
let $end= )group by a ;
let $start_app= where a> ( select sum(a) from t1 ;
let $end_pre= )group by b limit 1 ;
--disable_result_log
--disable_query_log
# At least 4 level nesting should work without errors
while ($should_work_nesting)
{
--echo $should_work_nesting
eval $start $end;
eval explain $start $end;
let $start= $start
$start_app;
let $end= $end_pre
$end;
dec $should_work_nesting;
}
# Other may fail with the 'stack overrun error'
while ($nesting)
{
--echo $nesting
--error 0,1436
eval $start $end;
--error 0,1436
eval explain $start $end;
let $start= $start
$start_app;
let $end= $end_pre
$end;
dec $nesting;
}
--enable_result_log
--enable_query_log
drop table t1;
#
# Bug #28076: inconsistent binary/varbinary comparison
#
......
......@@ -2157,6 +2157,35 @@ class Item_ref :public Item_ident
Item_field *filed_for_view_update()
{ return (*ref)->filed_for_view_update(); }
virtual Ref_Type ref_type() { return REF; }
// Row emulation: forwarding of ROW-related calls to ref
uint cols()
{
return ref && result_type() == ROW_RESULT ? (*ref)->cols() : 1;
}
Item* element_index(uint i)
{
return ref && result_type() == ROW_RESULT ? (*ref)->element_index(i) : this;
}
Item** addr(uint i)
{
return ref && result_type() == ROW_RESULT ? (*ref)->addr(i) : 0;
}
bool check_cols(uint c)
{
return ref && result_type() == ROW_RESULT ? (*ref)->check_cols(c)
: Item::check_cols(c);
}
bool null_inside()
{
return ref && result_type() == ROW_RESULT ? (*ref)->null_inside() : 0;
}
void bring_value()
{
if (ref && result_type() == ROW_RESULT)
(*ref)->bring_value();
}
};
......
......@@ -3494,6 +3494,6 @@ void Item_func_group_concat::print(String *str)
Item_func_group_concat::~Item_func_group_concat()
{
if (unique_filter)
if (!original && unique_filter)
delete unique_filter;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment