• unknown's avatar
    Fixed bug #29611. · d50caace
    unknown authored
    If a primary key is defined over column c of enum type then 
    the EXPLAIN command for a look-up query of the form
      SELECT * FROM t WHERE c=0
    said that the query was with an impossible where condition though the
    query correctly returned non-empty result set when the table indeed 
    contained rows with error empty strings for column c. 
    
    This kind of misbehavior was due to a bug in the function 
    Field_enum::store(longlong,bool) that erroneously returned 1 if
    the the value to be stored was equal to 0. 
    Note that the method 
    Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
    correctly returned 0 if a value of the error empty string 
    was stored. 
    
    
    mysql-test/r/type_enum.result:
      Added a test case for bug #29661.
    mysql-test/t/type_enum.test:
      Added a test case for bug #29661.
    sql/field.cc:
      Fixed bug #29611.
      If a primary key was defined over column c of enum type then 
      the EXPLAIN command for a look-up query of the form
        SELECT * FROM t WHERE c=0
      said that the query was with an impossible where condition though the
      query correctly returned non-empty result set when the table indeed 
      contained rows with error empty strings for column c. 
      
      This kind of misbehavior was due to a bug in the function 
      Field_enum::store(longlong,bool) that erroneously returned 1 if
      the the value to be stored was equal to 0. 
      Note that the method 
      Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
      correctly returned 0 if a value of the error empty string 
      was stored.
    d50caace
field.cc 249 KB