~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_rkey.cc

  • Committer: Prafulla Tekawade
  • Date: 2010-08-06 11:21:12 UTC
  • mto: (1711.1.21 build) (1725.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1714.
  • Revision ID: prafulla_t@users.sourceforge.net-20100806112112-7w5u0s3nx9u67nzt
Fix for Bug 586051

1. test_if_ref method which checks whether predicate is already evaluated
   due to ref/eq_ref access or not was incorrectly removing a predicate 
   that was not implicitly evaluated due to ref access (due to presence of filesort ?)
   It was field=NULL predicate.
   Such predicate should be kept and execution engine will filter out rows
   correctly. Removal of such predicate led to returning of rows which had
   NULL for join/predicate columns.
2. field COMP_OP NULL will always false for all fields except when COMP_OP
   is NULL-safe equality operator. Modified range optimizer to return zero
   row count in such cases.
   Query now does not even run. It returns zero result. As such Fix(1) is not
   required but we might hit that case in some other query (I have not tried it
   yet)
3. Fixed Field::val_str to print "NULL" for literal NULL instead of "0". It
   added lot of confusion while debugging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/* Read record based on a key */
17
17
 
68
68
  if (fast_mi_readinfo(info))
69
69
    goto err;
70
70
 
 
71
  if (share->concurrent_insert)
 
72
    pthread_rwlock_rdlock(&share->key_root_lock[inx]);
 
73
 
71
74
  nextflag=myisam_read_vec[search_flag];
72
75
  use_key_length=pack_key_length;
73
76
  if (!(nextflag & (SEARCH_FIND | SEARCH_NO_FIND | SEARCH_LAST)))
132
135
      if (res == 2)
133
136
      {
134
137
        info->lastpos= HA_OFFSET_ERROR;
 
138
        if (share->concurrent_insert)
 
139
          pthread_rwlock_unlock(&share->key_root_lock[inx]);
135
140
        return((errno= HA_ERR_KEY_NOT_FOUND));
136
141
      }
137
142
      /*
146
151
      }
147
152
    }
148
153
  }
 
154
  if (share->concurrent_insert)
 
155
    pthread_rwlock_unlock(&share->key_root_lock[inx]);
149
156
 
150
157
  /* Calculate length of the found key;  Used by mi_rnext_same */
151
158
  if ((keyinfo->flag & HA_VAR_LENGTH_KEY) && last_used_keyseg &&