-
Roy Lyseng authored
The problem arose because the automatic key generation part of derived table handling did not handle properly columns specified as part of the VALUES() clause. As a side note, the VALUES() clause (that is not used as a <table value constructor>) is seriously flawed and should be replaced with some other mechanism. What happens is that when VALUES() is detected outside where it is meaningful, its value should be NULL and is thus replaced with a Field_null object, with the same name as the original field. In update_derived_keys() this is let through, and when a key is added in TABLE::add_tmp_key(), the generated field's name is compared with the table`s field names, which contains a blob field with the same name. This field type is not accepted and an assert is triggered. The solution appears to be to replace the NULL field with a NULL const instead. Fields with type NULL are generally not handled well inside the server (e.g Innnodb will not accept them and it is impossible to create them in regular tables), so this seems like an overall good change.
Roy Lyseng authoredThe problem arose because the automatic key generation part of derived table handling did not handle properly columns specified as part of the VALUES() clause. As a side note, the VALUES() clause (that is not used as a <table value constructor>) is seriously flawed and should be replaced with some other mechanism. What happens is that when VALUES() is detected outside where it is meaningful, its value should be NULL and is thus replaced with a Field_null object, with the same name as the original field. In update_derived_keys() this is let through, and when a key is added in TABLE::add_tmp_key(), the generated field's name is compared with the table`s field names, which contains a blob field with the same name. This field type is not accepted and an assert is triggered. The solution appears to be to replace the NULL field with a NULL const instead. Fields with type NULL are generally not handled well inside the server (e.g Innnodb will not accept them and it is impossible to create them in regular tables), so this seems like an overall good change.
Loading