• Norvald H. Ryeng's avatar
    Bug#13031606 VALUES() IN A SELECT STATEMENT CRASHES SERVER · ad031d51
    Norvald H. Ryeng authored
    Problem: Grouping results by VALUES(alias for string literal) causes
    the server to crash.
    
    Item_insert_values is not constructed to handle other types of
    arguments than field and reference to field. In this case, the
    argument is an Item_string, and this causes
    Item_insert_values::fix_fields() to crash.
    
    Fix: Issue an error message when the argument to Item_insert_values is
    not a field or a reference to a field.
    
    This is slightly in breach with documentation, which states that
    VALUES should return NULL, but the error message is only issued in
    cases where the server otherwise would crash, so there is no change in
    behavior for queries that already work. Future versions will restrict
    syntax so that using VALUES in this way is illegal.
    
    
    mysql-test/r/errors.result:
      Add test case for bug #13031606.
    mysql-test/t/errors.test:
      Add test case for bug #13031606.
    sql/item.cc:
      Issue error message if argument is not field or reference to field.
    ad031d51
errors.test 2.1 KB