Commit f93cb632 authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Fixed problem with auto_increment key as not first key part

parent d909f4a5
......@@ -46928,6 +46928,9 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.52
@itemize @bullet
@item
Fixed bug with creating an auto-increment value on second part of a
@code{UNIQUE()} key where first part could contain NULL values.
@item
Don't write slave-timeout reconnects to the error log.
@item
Fixed bug with slave net read timeouting
......@@ -59,7 +59,7 @@ int find_ref_key(TABLE *table,Field *field, uint *key_length)
{
if (key_part->offset == fieldpos)
return(i); /* Use this key */
*key_length+=key_part->length;
*key_length+=key_part->store_length;
}
}
return(-1); /* No key is ok */
......
......@@ -346,17 +346,7 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
}
}
if (reg_field->unireg_check == Field::NEXT_NUMBER)
{
if ((int) (outparam->next_number_index= (uint)
find_ref_key(outparam,reg_field,
&outparam->next_number_key_offset)) < 0)
reg_field->unireg_check=Field::NONE; /* purecov: inspected */
else
{
outparam->found_next_number_field=reg_field;
reg_field->flags|=AUTO_INCREMENT_FLAG;
}
}
outparam->found_next_number_field= reg_field;
if (outparam->timestamp_field == reg_field)
outparam->timestamp_field_offset=i;
if (use_hash)
......@@ -507,6 +497,19 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
bfill(outparam->null_flags+outparam->rec_buff_length*2,null_length,255);
}
if ((reg_field=outparam->found_next_number_field))
{
if ((int) (outparam->next_number_index= (uint)
find_ref_key(outparam,reg_field,
&outparam->next_number_key_offset)) < 0)
{
reg_field->unireg_check=Field::NONE; /* purecov: inspected */
outparam->found_next_number_field=0;
}
else
reg_field->flags|=AUTO_INCREMENT_FLAG;
}
if (outparam->blob_fields)
{
Field **ptr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment