diff options
author | unknown <jimw@mysql.com> | 2005-06-02 10:00:36 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-06-02 10:00:36 -0700 |
commit | dd8e174fa6a07ebf21a3b0a03883d2be694b827b (patch) | |
tree | 8309f556a20c1a66cc32a1665fcfeae4683f0a01 /sql | |
parent | f0329bfb8c9215272cc176c874f79d14a02d20fa (diff) | |
download | mariadb-git-dd8e174fa6a07ebf21a3b0a03883d2be694b827b.tar.gz |
Additional tweak to fix for bug #10543, to prevent a change in
behavior when extending fields that were fully part of a
multi-part key.
mysql-test/r/key.result:
Update results
mysql-test/t/key.test:
Add test for behavior of extending fields in a multi-part key
that were defined with a partial length the same as their
field length.
sql/sql_table.cc:
Reset key_part_length when old field length was the same as the
old key_part_length.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sql_table.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2768d503751..eccba6a90ba 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3341,11 +3341,15 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, previous type, or the field length is less than the key part length, unset the key part length. + We also unset the key part length if it is the same as the + old field's length, so the whole new field will be used. + BLOBs may have cfield->length == 0, which is why we test it before checking whether cfield->length < key_part_length (in chars). */ if (!Field::type_can_have_key_part(cfield->field->type()) || !Field::type_can_have_key_part(cfield->sql_type) || + cfield->field->field_length == key_part_length || (cfield->length && (cfield->length < key_part_length / key_part->field->charset()->mbmaxlen))) key_part_length= 0; // Use whole field |