mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Merge a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-4.1
into a193-229-222-105.elisa-laajakaista.fi:/home/my/bk/mysql-5.0
This commit is contained in:
commit
91b6fe2679
2 changed files with 19 additions and 5 deletions
|
@ -48,6 +48,15 @@ insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),(
|
||||||
select * from t1 procedure analyse();
|
select * from t1 procedure analyse();
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#10716 - Procedure Analyse results in wrong values for optimal field type
|
||||||
|
#
|
||||||
|
|
||||||
|
create table t1 (d double);
|
||||||
|
insert into t1 values (100000);
|
||||||
|
select * from t1 procedure analyse (1,1);
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|
||||||
#decimal-related test
|
#decimal-related test
|
||||||
|
|
|
@ -880,18 +880,23 @@ void field_real::get_opt_type(String *answer,
|
||||||
if (!max_notzero_dec_len)
|
if (!max_notzero_dec_len)
|
||||||
{
|
{
|
||||||
if (min_arg >= -128 && max_arg <= (min_arg >= 0 ? 255 : 127))
|
if (min_arg >= -128 && max_arg <= (min_arg >= 0 ? 255 : 127))
|
||||||
sprintf(buff, "TINYINT(%d)", (int) max_length - (item->decimals + 1));
|
sprintf(buff, "TINYINT(%d)", (int) max_length -
|
||||||
|
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
|
||||||
else if (min_arg >= INT_MIN16 && max_arg <= (min_arg >= 0 ?
|
else if (min_arg >= INT_MIN16 && max_arg <= (min_arg >= 0 ?
|
||||||
UINT_MAX16 : INT_MAX16))
|
UINT_MAX16 : INT_MAX16))
|
||||||
sprintf(buff, "SMALLINT(%d)", (int) max_length - (item->decimals + 1));
|
sprintf(buff, "SMALLINT(%d)", (int) max_length -
|
||||||
|
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
|
||||||
else if (min_arg >= INT_MIN24 && max_arg <= (min_arg >= 0 ?
|
else if (min_arg >= INT_MIN24 && max_arg <= (min_arg >= 0 ?
|
||||||
UINT_MAX24 : INT_MAX24))
|
UINT_MAX24 : INT_MAX24))
|
||||||
sprintf(buff, "MEDIUMINT(%d)", (int) max_length - (item->decimals + 1));
|
sprintf(buff, "MEDIUMINT(%d)", (int) max_length -
|
||||||
|
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
|
||||||
else if (min_arg >= INT_MIN32 && max_arg <= (min_arg >= 0 ?
|
else if (min_arg >= INT_MIN32 && max_arg <= (min_arg >= 0 ?
|
||||||
UINT_MAX32 : INT_MAX32))
|
UINT_MAX32 : INT_MAX32))
|
||||||
sprintf(buff, "INT(%d)", (int) max_length - (item->decimals + 1));
|
sprintf(buff, "INT(%d)", (int) max_length -
|
||||||
|
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
|
||||||
else
|
else
|
||||||
sprintf(buff, "BIGINT(%d)", (int) max_length - (item->decimals + 1));
|
sprintf(buff, "BIGINT(%d)", (int) max_length -
|
||||||
|
((item->decimals == NOT_FIXED_DEC) ? 0 : (item->decimals + 1)));
|
||||||
answer->append(buff, (uint) strlen(buff));
|
answer->append(buff, (uint) strlen(buff));
|
||||||
if (min_arg >= 0)
|
if (min_arg >= 0)
|
||||||
answer->append(" UNSIGNED");
|
answer->append(" UNSIGNED");
|
||||||
|
|
Loading…
Add table
Reference in a new issue