4455 Ole John Aske 2011-08-16
Cherry picked fix for Bug#12798270 into 'mysql-5.1-telco-7.0' as this branch also contained
the (cherry picked) fix for Bug 11764737 which made this problem to surface.
modified:
mysql-test/r/group_by.result
mysql-test/t/group_by.test
sql/sql_select.cc
4454 jonas oreland 2011-08-16
ndb - fix build problem...
modified:
storage/ndb/src/kernel/blocks/dbtux/DbtuxNode.cpp
=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result 2010-10-29 08:23:06 +0000
+++ b/mysql-test/r/group_by.result 2011-08-16 10:20:19 +0000
@@ -1856,3 +1856,18 @@ COUNT(*)
2
DROP TABLE t1;
# End of 5.1 tests
+#
+# Bug#12798270: ASSERTION `!TAB->SORTED' FAILED IN JOIN_READ_KEY2
+#
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1);
+CREATE TABLE t2 (pk int PRIMARY KEY);
+INSERT INTO t2 VALUES (10);
+CREATE VIEW v1 AS SELECT t2.pk FROM t2;
+SELECT v1.pk
+FROM t1 LEFT JOIN v1 ON t1.i = v1.pk
+GROUP BY v1.pk;
+pk
+DROP VIEW v1;
+DROP TABLE t1,t2;
+# End of Bug#12798270
=== modified file 'mysql-test/t/group_by.test'
--- a/mysql-test/t/group_by.test 2010-10-29 08:23:06 +0000
+++ b/mysql-test/t/group_by.test 2011-08-16 10:20:19 +0000
@@ -1248,3 +1248,24 @@ ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1;
DROP TABLE t1;
--echo # End of 5.1 tests
+
+--echo #
+--echo # Bug#12798270: ASSERTION `!TAB->SORTED' FAILED IN JOIN_READ_KEY2
+--echo #
+
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1);
+
+CREATE TABLE t2 (pk int PRIMARY KEY);
+INSERT INTO t2 VALUES (10);
+
+CREATE VIEW v1 AS SELECT t2.pk FROM t2;
+
+SELECT v1.pk
+FROM t1 LEFT JOIN v1 ON t1.i = v1.pk
+GROUP BY v1.pk;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+--echo # End of Bug#12798270
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2011-06-30 15:59:25 +0000
+++ b/sql/sql_select.cc 2011-08-16 10:20:19 +0000
@@ -6876,7 +6876,15 @@ make_join_readinfo(JOIN *join, ulonglong
(join->sort_by_table == (TABLE *) 1 && i != join->const_tables)))
ordered_set= 1;
+#ifdef MCP_BUG12798270
tab->sorted= sorted;
+#else
+ /*
+ For eq_ref there is at most one join match for each row from
+ previous tables so ordering is not useful.
+ */
+ tab->sorted= (tab->type != JT_EQ_REF) ? sorted : false;
+#endif
sorted= 0; // only first must be sorted
table->status=STATUS_NO_RECORD;
pick_table_access_method (tab);
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (ole.john.aske:4454 to 4455)Bug#12798270 | Ole John Aske | 17 Aug |