[Commits] Rev 3864: Fixed bug mdev-4959. in file:///home/igor/maria/maria-5.5/

Igor Babaev igor at askmonty.org
Wed Aug 28 19:14:57 EEST 2013


At file:///home/igor/maria/maria-5.5/

------------------------------------------------------------
revno: 3864
revision-id: igor at askmonty.org-20130828161457-pvypsz6bhdzbtjgn
parent: igor at askmonty.org-20130828051914-sg94r4juylewvg6x
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.5
timestamp: Wed 2013-08-28 09:14:57 -0700
message:
  Fixed bug mdev-4959.
  The fix for mdev-4420 was not quite correct. This patch corrects it.
-------------- next part --------------
=== modified file 'mysql-test/r/join.result'
--- a/mysql-test/r/join.result	2013-08-23 14:25:45 +0000
+++ b/mysql-test/r/join.result	2013-08-28 16:14:57 +0000
@@ -1477,4 +1477,23 @@
 #
 SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1
+#
+# MDEV-4959: join of const table with NULL fields
+#
+CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL);
+CREATE TABLE t2 (i2 int, a int, b int) ENGINE=MyISAM;
+CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
+INSERT INTO t2 VALUES (NULL,1,2),(NULL,2,3);
+SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;
+i1	i2	a	b
+EXPLAIN EXTENDED
+SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+2	DERIVED	t2	ALL	NULL	NULL	NULL	NULL	2	100.00	
+Warnings:
+Note	1003	select NULL AS `i1`,`v2`.`i2` AS `i2`,`v2`.`a` AS `a`,`v2`.`b` AS `b` from `test`.`v2` where ((`v2`.`i2` = NULL) and (`v2`.`a` < `v2`.`b`))
+DROP VIEW v2;
+DROP TABLE t1,t2;
 SET optimizer_switch=@save_optimizer_switch;

=== modified file 'mysql-test/t/join.test'
--- a/mysql-test/t/join.test	2013-07-04 15:37:55 +0000
+++ b/mysql-test/t/join.test	2013-08-28 16:14:57 +0000
@@ -1141,5 +1141,21 @@
 --error ER_PARSE_ERROR
 SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);
 
+--echo #
+--echo # MDEV-4959: join of const table with NULL fields
+--echo #
+
+CREATE TABLE t1 (i1 int) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (NULL);
+CREATE TABLE t2 (i2 int, a int, b int) ENGINE=MyISAM;
+CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2;
+INSERT INTO t2 VALUES (NULL,1,2),(NULL,2,3);
+
+SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;
+EXPLAIN EXTENDED
+SELECT * FROM t1 JOIN v2 ON i1 = i2 WHERE a < b;
+
+DROP VIEW v2;
+DROP TABLE t1,t2;
 
 SET optimizer_switch=@save_optimizer_switch;

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2013-08-28 05:19:14 +0000
+++ b/sql/sql_select.cc	2013-08-28 16:14:57 +0000
@@ -8256,7 +8256,8 @@
           Item *item= tab->ref.items[keypart];
           Item *notnull;
           Item *real= item->real_item();
-	  if (real->const_item() && !real->is_expensive())
+	  if (real->const_item() && real->type() != Item::FIELD_ITEM && 
+              !real->is_expensive())
           {
             /*
               It could be constant instead of field after constant



More information about the commits mailing list