[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-internals
Subject:    bk commit into 5.0 tree (konstantin:1.1772) BUG#8801
From:       konstantin () mysql ! com
Date:       2005-02-28 21:19:05
Message-ID: 20050228211905.7DAB8A9F5 () dragonfly ! local
[Download RAW message or body]

Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1772 05/03/01 00:18:58 konstantin@mysql.com +1 -0
  Proposed fix for Bug#8801: the bug was in co-operation of Item_ref
  with view-merge algorithm and prepared statements: in case when some
  Item_ref pointing to a view column was substituted with a reference 
  pointing to the view expression for that column
  Item_ref::ref member of the original Item_ref was left pointing to 
  not_found_item (0x1).
  As we currently perform expression substition part of the view-merge 
  algorithm per each execution of a prepared statement or stored procedure, 
  we need to preserve original Item_ref objects usable.

  sql/item.cc
    1.119 05/03/01 00:18:53 konstantin@mysql.com +10 -7
    Set member Item_ref::ref to null whenever the item itself is substituted 
    with another item.
    This is necessary if we want to re-execute a prepared statement next time.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	konstantin
# Host:	dragonfly.local
# Root:	/media/sda1/mysql/mysql-5.0-8801

--- 1.118/sql/item.cc	2005-02-26 18:15:31 +03:00
+++ 1.119/sql/item.cc	2005-03-01 00:18:53 +03:00
@@ -3513,6 +3513,9 @@
     Item_field::fix_fields, here we first search the SELECT and GROUP BY
     clauses, and then we search the FROM clause.
 
+  POSTCONDITION
+    Item_ref::ref is 0 or points to a valid item
+
   RETURN
     TRUE  if error
     FALSE on success
@@ -3534,6 +3537,7 @@
 
     if (ref == not_found_item) /* This reference was not resolved. */
     {
+      ref= 0;
       /*
         If there is an outer select, and it is not a derived table (which do
         not support the use of outer fields for now), try to resolve this
@@ -3568,6 +3572,7 @@
               prev_subselect_item->const_item_cache&= (*ref)->const_item();
               break;
             }
+            ref= 0;
           }
 
           /* Search in the tables of the FROM clause of the outer select. */
@@ -3641,14 +3646,12 @@
             break; /* Do not consider derived tables. */
         }
 
-        DBUG_ASSERT(ref != 0);
         if (!from_field)
           return TRUE;
-        if (ref == not_found_item && from_field == not_found_field)
+        if (ref == 0 && from_field == not_found_field)
         {
           my_error(ER_BAD_FIELD_ERROR, MYF(0),
                    this->full_name(), current_thd->where);
-          ref= 0;                                 // Safety
           return TRUE;
         }
         if (from_field != not_found_field)
@@ -3658,7 +3661,6 @@
             this will ensure we get an error if this item would be used
             elsewhere
           */
-          ref= 0;                                 // Safety
           if (from_field != view_ref_found)
           {
             Item_field* fld;
@@ -3696,6 +3698,7 @@
     }
   }
 
+  DBUG_ASSERT(*ref);
   /*
     Check if this is an incorrect reference in a group function or forward
     reference. Do not issue an error if this is an unnamed reference inside an
@@ -3716,9 +3719,9 @@
 
   set_properties();
 
-  if (ref && (*ref)->check_cols(1))
-    return 1;
-  return 0;
+  if ((*ref)->check_cols(1))
+    return TRUE;
+  return FALSE;
 }
 
 void Item_ref::set_properties()

-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/internals?unsub=mysql-internals@progressive-comp.com

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic