Commit feb36554 authored by Chaithra Gopalareddy's avatar Chaithra Gopalareddy

Merge from 5.1 to 5.5

parents a40ea266 b140c368
...@@ -1702,4 +1702,36 @@ EXECUTE prep_stmt; ...@@ -1702,4 +1702,36 @@ EXECUTE prep_stmt;
f f
1 1
DROP TABLE t1; DROP TABLE t1;
#
# Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
# WRONG RESULT
#
CREATE TABLE t1 (i1 int);
INSERT INTO t1 VALUES (100), (101);
CREATE TABLE t2 (i2 int, i3 int);
INSERT INTO t2 VALUES (20,1),(10,2);
CREATE TABLE t3 (i4 int(11));
INSERT INTO t3 VALUES (1),(2);
SELECT (
SELECT MAX( t2.i2 )
FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
WHERE t2.i3 <> t1.i1
) AS field1
FROM t1;;
field1
20
20
SELECT (
SELECT MAX( t2.i2 )
FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
WHERE t2.i3 <> t1.i1
) AS field1
FROM t1 GROUP BY field1;;
field1
20
drop table t1,t2,t3;
# End of test for Bug#13068506
End of 5.1 tests End of 5.1 tests
...@@ -1272,5 +1272,35 @@ EXECUTE prep_stmt; ...@@ -1272,5 +1272,35 @@ EXECUTE prep_stmt;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#13068506 - QUERY WITH GROUP BY ON NON-AGGR COLUMN RETURNS
--echo # WRONG RESULT
--echo #
CREATE TABLE t1 (i1 int);
INSERT INTO t1 VALUES (100), (101);
CREATE TABLE t2 (i2 int, i3 int);
INSERT INTO t2 VALUES (20,1),(10,2);
CREATE TABLE t3 (i4 int(11));
INSERT INTO t3 VALUES (1),(2);
let $query= SELECT (
SELECT MAX( t2.i2 )
FROM t3 RIGHT JOIN t2 ON ( t2.i3 = 2 )
WHERE t2.i3 <> t1.i1
) AS field1
FROM t1;
--echo
--eval $query;
--echo
--eval $query GROUP BY field1;
--echo
drop table t1,t2,t3;
--echo # End of test for Bug#13068506
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -2720,6 +2720,8 @@ public: ...@@ -2720,6 +2720,8 @@ public:
{ {
return (*ref)->const_item() ? 0 : OUTER_REF_TABLE_BIT; return (*ref)->const_item() ? 0 : OUTER_REF_TABLE_BIT;
} }
table_map not_null_tables() const { return 0; }
virtual Ref_Type ref_type() { return OUTER_REF; } virtual Ref_Type ref_type() { return OUTER_REF; }
}; };
......
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