← Back to team overview

maria-developers team mailing list archive

Re: [Commits] Rev 3077: Fixed LP bug #904345. in file:///home/igor/maria/maria-5.2-bug904345/

 

Hi!

27.12.2011 20:46, Igor Babaev пишет:
At file:///home/igor/maria/maria-5.2-bug904345/

------------------------------------------------------------
revno: 3077
revision-id: igor@xxxxxxxxxxxx-20111227184559-v7hlo1h98dz8ui32
parent: wlad@xxxxxxxxxxxxxxxx-20111223140257-k34gmwhs5msbc57k
committer: Igor Babaev<igor@xxxxxxxxxxxx>
branch nick: maria-5.2-bug904345
timestamp: Tue 2011-12-27 10:45:59 -0800
message:
   Fixed LP bug #904345.

   The MIN/MAX optimizer code from the function opt_sum_query erroneously
   did not take into account conjunctive conditions that did not depend on
   any table, yet were not identified as constant items. These could be
   items containing rand() or PS/SP parameters. These items are supposed
   to be evaluated at the execution phase. That's why if such conditions
   can be extracted from the WHERE condition the MIN/MAX optimization is
   not applied as currently it is always done at the optimization phase.

   (In 5.3 expensive subqueries are also evaluated only at the execution
   phase. So, if a constant condition with such subquery can be extracted
   from the WHERE clause the MIN/MAX optimization should not be applied
   in 5.3.)

   IF an IN/ALL/SOME predicate with a constant left part is transformed
   into an EXISTS subquery the resulting subquery should not be considered
   uncacheable if the right part of the predicate is not uncacheable.

   Backported the function dbug_print_item() from 5.3. The function is used
   only for debugging.
[skip]
=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-11-24 16:48:58 +0000
+++ b/sql/item.cc	2011-12-27 18:45:59 +0000
@@ -7915,6 +7915,22 @@
    ((TABLE_LIST *)data)->hide_view_error(thd);
  }

+/* Debugger help function */
+static char dbug_item_print_buf[256];
+
+const char *dbug_print_item(Item *item)
+{
+  char *buf= dbug_item_print_buf;
+  String str(buf, sizeof(dbug_item_print_buf),&my_charset_bin);
+  str.length(0);
+  if (!item)
+    return "(Item*)NULL";
+  item->print(&str ,QT_ORDINARY);
+  if (str.c_ptr() == buf)
+    return buf;
+  else
+    return "Couldn't fit into buffer";
+}
This should be put under #ifndef DBUG_OFF

Everything else looks OK to be pushed.

[skip]