[Commits] Rev 3732: Fixed bug mdev-5382. in file:///home/igor/maria/maria-5.3-mdev5382/

Igor Babaev igor at askmonty.org
Thu Dec 5 07:43:07 EET 2013


At file:///home/igor/maria/maria-5.3-mdev5382/

------------------------------------------------------------
revno: 3732
revision-id: igor at askmonty.org-20131205054307-blbzsaxzcfoc3lm7
parent: bar at mnogosearch.org-20131203110843-1bsdu0hcrpzhie8w
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.3-mdev5382
timestamp: Wed 2013-12-04 21:43:07 -0800
message:
  Fixed bug mdev-5382.
  The function Item_field::register_field_in_read_map() should take
  care of the cases when Item_field::field == 0, i.e. is not set yet.
-------------- next part --------------
=== modified file 'mysql-test/r/union.result'
--- a/mysql-test/r/union.result	2013-11-13 22:43:09 +0000
+++ b/mysql-test/r/union.result	2013-12-05 05:43:07 +0000
@@ -1738,4 +1738,19 @@
 6
 DROP VIEW v1;
 DROP TABLE t1;
+#
+# mdev-5382:  UNION with ORDER BY in subselect
+#
+CREATE TABLE t1 (a int DEFAULT NULL);
+INSERT INTO t1 VALUES (2), (4);
+CREATE TABLE t2 (b int DEFAULT NULL);
+INSERT INTO t2 VALUES (1), (3);
+SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b
+UNION ALL
+SELECT a FROM t1 WHERE t1.a+3<= t2.b
+ORDER BY a DESC) AS c1 FROM t2) t3;
+c1
+NULL
+2
+DROP TABLE t1,t2;
 End of 5.3 tests

=== modified file 'mysql-test/t/union.test'
--- a/mysql-test/t/union.test	2013-11-13 22:43:09 +0000
+++ b/mysql-test/t/union.test	2013-12-05 05:43:07 +0000
@@ -1227,5 +1227,21 @@
  DROP VIEW v1;
  DROP TABLE t1;
 
+--echo #
+--echo # mdev-5382:  UNION with ORDER BY in subselect
+--echo #
+ 
+ CREATE TABLE t1 (a int DEFAULT NULL);
+ INSERT INTO t1 VALUES (2), (4);
+ CREATE TABLE t2 (b int DEFAULT NULL);
+ INSERT INTO t2 VALUES (1), (3);
+ 
+ SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b
+                         UNION ALL
+                         SELECT a FROM t1 WHERE t1.a+3<= t2.b
+                         ORDER BY a DESC) AS c1 FROM t2) t3;
+
+ DROP TABLE t1,t2;
+ 
  --echo End of 5.3 tests
 

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2013-11-21 07:46:36 +0000
+++ b/sql/item.cc	2013-12-05 05:43:07 +0000
@@ -930,6 +930,8 @@
 bool Item_field::register_field_in_read_map(uchar *arg)
 {
   TABLE *table= (TABLE *) arg;
+  if (!field)
+    return 0;
   if (field->table == table || !table)
     bitmap_set_bit(field->table->read_set, field->field_index);
   if (field->vcol_info && field->vcol_info->expr_item)



More information about the commits mailing list