1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fixed bug in CREATE ... DECIMAL(-1,1). Bug #432

mysql-test/mysql-test-run.sh:
  Ensure that tests are sorted
mysql-test/r/type_decimal.result:
  Test for bug with decimal()
mysql-test/t/type_decimal.test:
  Test for bug with decimal()
sql/sql_parse.cc:
  Fixed bug in CREATE ... DECIMAL(-1,1)
This commit is contained in:
unknown
2003-05-14 22:12:55 +03:00
parent 7297502a7b
commit ac316cfdb3
4 changed files with 27 additions and 8 deletions

View File

@ -2977,9 +2977,8 @@ bool add_field_to_list(char *field_name, enum_field_types type,
new_field->change=change;
new_field->interval=0;
new_field->pack_length=0;
if (length)
if (!(new_field->length= (uint) atoi(length)))
length=0; /* purecov: inspected */
if (length && !(new_field->length= (uint) atoi(length)))
length=0; /* purecov: inspected */
uint sign_len=type_modifier & UNSIGNED_FLAG ? 0 : 1;
if (new_field->length && new_field->decimals &&
@ -3015,10 +3014,13 @@ bool add_field_to_list(char *field_name, enum_field_types type,
break;
case FIELD_TYPE_DECIMAL:
if (!length)
new_field->length = 10; // Default length for DECIMAL
new_field->length+=sign_len;
if (new_field->decimals)
new_field->length++;
new_field->length= 10; // Default length for DECIMAL
if (new_field->length < MAX_FIELD_WIDTH) // Skip wrong argument
{
new_field->length+=sign_len;
if (new_field->decimals)
new_field->length++;
}
break;
case FIELD_TYPE_BLOB:
case FIELD_TYPE_TINY_BLOB: