Commit 749157d6 authored by kaa@kaamos.(none)'s avatar kaa@kaamos.(none)
Browse files

Merge kaamos.(none):/data/src/opt/bug33305/my50-bug33305

into  kaamos.(none):/data/src/opt/mysql-5.0-opt
parents 578b3632 165dfa3e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1407,4 +1407,16 @@ SELECT COUNT(*), a FROM t1;
COUNT(*)	a
4	1
DROP TABLE t1;
set SQL_MODE=ONLY_FULL_GROUP_BY;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4);
CREATE VIEW v1 AS SELECT a,(a + 1) AS y FROM t1;
EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using temporary; Using filesort
Warnings:
Note	1003	select (`test`.`t1`.`a` + 1) AS `y` from `test`.`t1` group by (`test`.`t1`.`a` + 1)
DROP VIEW v1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;
End of 5.0 tests
+9 −0
Original line number Diff line number Diff line
@@ -4383,4 +4383,13 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION 
(SELECT 1 FROM t2 WHERE t1.a = t2.a))' at line 2
DROP TABLE t1,t2;
create table t1(f11 int, f12 int);
create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
insert into t1 values(1,1),(2,2), (3, 3);
set session sort_buffer_size= 33*1024;
select count(*) from t1 where f12 = 
(select f22 from t2 where f22 = f12 order by f21 desc, f22, f23 limit 1);
count(*)
3
drop table t1,t2;
End of 5.0 tests.
+0 −4
Original line number Diff line number Diff line
@@ -786,10 +786,6 @@ from (select 1 as s,'t' as t union select null, null ) as sub1;
select group_concat(t) from t1 group by week(date)/10;
group_concat(t)
t
Warnings:
Warning	1292	Truncated incorrect datetime value: '0000-00-00'
Warning	1292	Truncated incorrect datetime value: '0000-00-00'
Warning	1292	Truncated incorrect datetime value: '0000-00-00'
drop table t1;
CREATE TABLE t1 (
qty decimal(16,6) default NULL, 
+15 −0
Original line number Diff line number Diff line
@@ -901,5 +901,20 @@ SELECT COUNT(*), a FROM t1;

DROP TABLE t1;

#
# Bug #33133: Views are not transparent
#

set SQL_MODE=ONLY_FULL_GROUP_BY;

CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4);
CREATE VIEW v1 AS SELECT a,(a + 1) AS y FROM t1;
EXPLAIN EXTENDED SELECT y FROM v1 GROUP BY v1.y;

DROP VIEW v1;
DROP TABLE t1;
SET SQL_MODE=DEFAULT;

###
--echo End of 5.0 tests
+22 −0
Original line number Diff line number Diff line
@@ -3230,4 +3230,26 @@ SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
DROP TABLE t1,t2;


#
# Bug#33675: Usage of an uninitialized memory by filesort in a subquery
#            caused server crash.
#
create table t1(f11 int, f12 int);
create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
insert into t1 values(1,1),(2,2), (3, 3);
let $i=10000;
--disable_query_log
--disable_warnings
while ($i)
{
  eval insert into t2 values (-1 , $i/5000 + 1, '$i');
  dec $i;
}
--enable_warnings
--enable_query_log
set session sort_buffer_size= 33*1024;
select count(*) from t1 where f12 = 
(select f22 from t2 where f22 = f12 order by f21 desc, f22, f23 limit 1);

drop table t1,t2;
--echo End of 5.0 tests.
Loading