~prafulla-t/drizzle/drz-bugfix-586051

« back to all changes in this revision

Viewing changes to drizzled/item/field.cc

  • Committer: Prafulla Tekawade
  • Date: 2010-08-06 11:21:12 UTC
  • 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:
1261
1261
    char buff[MAX_FIELD_WIDTH];
1262
1262
    String tmp(buff,sizeof(buff),str->charset());
1263
1263
    field->val_str(&tmp);
1264
 
    str->append('\'');
1265
 
    str->append(tmp);
1266
 
    str->append('\'');
 
1264
    if (field->is_null())  {
 
1265
      str->append("NULL");
 
1266
    }
 
1267
    else {
 
1268
      str->append('\'');
 
1269
      str->append(tmp);
 
1270
      str->append('\'');
 
1271
    }
1267
1272
    return;
1268
1273
  }
1269
1274
  Item_ident::print(str, query_type);