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

Fix for BUG#6825: When calculating Item_func_neg::max_length, add 1 for '-'.

For numeric constants we only need to add, since the parser doesn't produce 
negative numbers. 
For strings we only add (we actually could substract 1 if given string is a constant 
and it has '-number' form but we're not doing that because 
 * we set max_length bigger then necessary in other cases as well.  
 * the current solution is simpler and safer (bigger max_length is better then cutting out)
This commit is contained in:
sergefp@mysql.com
2004-12-17 12:14:45 +03:00
parent 410086b347
commit da332aca40
4 changed files with 69 additions and 1 deletions

View File

@ -34,3 +34,19 @@ create table t1 (a char(4), b double, c date, d tinyint(4));
insert into t1 values ('AAAA', 105, '2003-03-01', 1);
select * from t1 where concat(A,C,B,D) = 'AAAA2003-03-011051';
drop table t1;
# BUG#6825
select 'a' union select concat('a', -4);
select 'a' union select concat('a', -4.5);
select 'a' union select concat('a', -(4 + 1));
select 'a' union select concat('a', 4 - 5);
select 'a' union select concat('a', -'3');
select 'a' union select concat('a', -concat('3',4));
select 'a' union select concat('a', -0);
select 'a' union select concat('a', -0.0);
select 'a' union select concat('a', -0.0000);