[Commits] Rev 3160: Fixed LP bug #825035. in file:///home/igor/maria/maria-5.3-trunk/

Igor Babaev igor at askmonty.org
Wed Aug 17 08:48:35 EEST 2011


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

------------------------------------------------------------
revno: 3160
revision-id: igor at askmonty.org-20110817054835-28vv34wesdsr8gm0
parent: monty at askmonty.org-20110816204508-hduu1db2zpwd476m
committer: Igor Babaev <igor at askmonty.org>
branch nick: maria-5.3-trunk
timestamp: Tue 2011-08-16 22:48:35 -0700
message:
  Fixed LP bug #825035.
  The value of maybe_null flag should be saved for the second execution
  of a prepared statement from SELECT that uses an outer join.
-------------- next part --------------
=== modified file 'mysql-test/r/join_outer.result'
--- a/mysql-test/r/join_outer.result	2011-08-09 07:28:57 +0000
+++ b/mysql-test/r/join_outer.result	2011-08-17 05:48:35 +0000
@@ -1593,3 +1593,25 @@
 b
 NULL
 DROP TABLE t1,t2,t3;
+#
+# LP bug #825035: second execution of PS with outer join
+#
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+CREATE TABLE t2 (a int);
+PREPARE stmt FROM 
+"SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a";
+EXECUTE stmt;
+a	a
+1	NULL
+2	NULL
+3	NULL
+4	NULL
+EXECUTE stmt;
+a	a
+1	NULL
+2	NULL
+3	NULL
+4	NULL
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1,t2;

=== modified file 'mysql-test/r/join_outer_jcl6.result'
--- a/mysql-test/r/join_outer_jcl6.result	2011-08-09 07:28:57 +0000
+++ b/mysql-test/r/join_outer_jcl6.result	2011-08-17 05:48:35 +0000
@@ -1602,6 +1602,28 @@
 b
 NULL
 DROP TABLE t1,t2,t3;
+#
+# LP bug #825035: second execution of PS with outer join
+#
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+CREATE TABLE t2 (a int);
+PREPARE stmt FROM 
+"SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a";
+EXECUTE stmt;
+a	a
+1	NULL
+2	NULL
+3	NULL
+4	NULL
+EXECUTE stmt;
+a	a
+1	NULL
+2	NULL
+3	NULL
+4	NULL
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1,t2;
 set join_cache_level=default;
 show variables like 'join_cache_level';
 Variable_name	Value

=== modified file 'mysql-test/t/join_outer.test'
--- a/mysql-test/t/join_outer.test	2011-08-09 07:28:57 +0000
+++ b/mysql-test/t/join_outer.test	2011-08-17 05:48:35 +0000
@@ -1154,3 +1154,22 @@
 FROM t1 LEFT JOIN t2 ON (t2.b) IN (SELECT c2 from t3) AND t2.a = 1;
 
 DROP TABLE t1,t2,t3;
+
+--echo #
+--echo # LP bug #825035: second execution of PS with outer join
+--echo #
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1),(2),(3),(4);
+
+CREATE TABLE t2 (a int);
+
+PREPARE stmt FROM 
+"SELECT * FROM t1 LEFT JOIN t2 ON t1.a = t2.a";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+
+DROP TABLE t1,t2;

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-07-19 20:19:10 +0000
+++ b/sql/sql_base.cc	2011-08-17 05:48:35 +0000
@@ -7847,6 +7847,7 @@
       {
         table_list->table->tablenr= table_list->tablenr_exec;
         table_list->table->map= table_list->map_exec;
+        table_list->table->maybe_null= table_list->maybe_null_exec;
         table_list->table->pos_in_table_list= table_list;
       }
       select_lex->leaf_tables.push_back(table_list);

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2011-07-17 06:57:43 +0000
+++ b/sql/sql_insert.cc	2011-08-17 05:48:35 +0000
@@ -3015,6 +3015,7 @@
       select_lex->leaf_tables_exec.push_back(table);
       table->tablenr_exec= table->table->tablenr;
       table->map_exec= table->table->map;
+      table->maybe_null_exec= table->table->maybe_null;
     }
     if (arena)
       thd->restore_active_arena(arena, &backup);

=== modified file 'sql/sql_lex.cc'
--- a/sql/sql_lex.cc	2011-07-19 20:19:10 +0000
+++ b/sql/sql_lex.cc	2011-08-17 05:48:35 +0000
@@ -3588,6 +3588,10 @@
       return 1;
     table->tablenr_exec= table->table->tablenr;
     table->map_exec= table->table->map;
+    if (join && (join->select_options & SELECT_DESCRIBE))
+      table->maybe_null_exec= 0;
+    else
+      table->maybe_null_exec= table->table->maybe_null;
   }
   if (arena)
     thd->restore_active_arena(arena, &backup);

=== modified file 'sql/sql_union.cc'
--- a/sql/sql_union.cc	2011-06-27 16:07:24 +0000
+++ b/sql/sql_union.cc	2011-08-17 05:48:35 +0000
@@ -371,6 +371,7 @@
     ulonglong create_options;
     uint save_tablenr= 0;
     table_map save_map= 0;
+    uint save_maybe_null= 0;
 
     while ((type= tp++))
     {
@@ -429,6 +430,7 @@
     {
       save_tablenr= result_table_list.tablenr_exec;
       save_map= result_table_list.map_exec;
+      save_maybe_null= result_table_list.maybe_null_exec;
     }
     bzero((char*) &result_table_list, sizeof(result_table_list));
     result_table_list.db= (char*) "";
@@ -438,6 +440,7 @@
     {
       result_table_list.tablenr_exec= save_tablenr;
       result_table_list.map_exec= save_map;
+      result_table_list.maybe_null_exec= save_maybe_null;
     }
 
     thd_arg->lex->current_select= lex_select_save;

=== modified file 'sql/table.h'
--- a/sql/table.h	2011-07-20 07:56:28 +0000
+++ b/sql/table.h	2011-08-17 05:48:35 +0000
@@ -1448,6 +1448,7 @@
   table_map     map_exec;
   /* TODO: check if this can be joined with jtbm_table_no */
   uint          tablenr_exec;
+  uint          maybe_null_exec;
 
   /* Ptr to parent MERGE table list item. See top comment in ha_myisammrg.cc */
   TABLE_LIST    *parent_l;



More information about the commits mailing list