mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#52430 Incorrect key in the error message for duplicate key error involving BINARY type
For BINARY(N) strip trailing zeroes to make the error message nice-looking
This commit is contained in:
10
sql/key.cc
10
sql/key.cc
@ -354,6 +354,16 @@ void key_unpack(String *to,TABLE *table,uint idx)
|
||||
{
|
||||
CHARSET_INFO *cs= field->charset();
|
||||
field->val_str(&tmp);
|
||||
/*
|
||||
For BINARY(N) strip trailing zeroes to make
|
||||
the error message nice-looking
|
||||
*/
|
||||
if (field->binary() && field->type() == MYSQL_TYPE_STRING && tmp.length())
|
||||
{
|
||||
const char *tmp_end= tmp.ptr() + tmp.length();
|
||||
while (tmp_end > tmp.ptr() && !*--tmp_end);
|
||||
tmp.length(tmp_end - tmp.ptr() + 1);
|
||||
}
|
||||
if (cs->mbmaxlen > 1 &&
|
||||
table->field[key_part->fieldnr - 1]->field_length !=
|
||||
key_part->length)
|
||||
|
Reference in New Issue
Block a user