Commit c87e002b authored by Sergei Golubchik's avatar Sergei Golubchik

str2decimal: don't return a negative zero

parent da372fb9
...@@ -221,7 +221,6 @@ drop table t1; ...@@ -221,7 +221,6 @@ drop table t1;
create table t1 (a decimal(10,2) unsigned); create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings: Warnings:
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 6 Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1"); insert into t1 values ("-.1"),("+.1"),(".1");
Warnings: Warnings:
...@@ -280,7 +279,6 @@ drop table t1; ...@@ -280,7 +279,6 @@ drop table t1;
create table t1 (a decimal(10,2) zerofill); create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings: Warnings:
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 6 Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1"); insert into t1 values ("-.1"),("+.1"),(".1");
Warnings: Warnings:
......
...@@ -222,7 +222,6 @@ drop table t1; ...@@ -222,7 +222,6 @@ drop table t1;
create table t1 (a decimal(10,2) unsigned); create table t1 (a decimal(10,2) unsigned);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings: Warnings:
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 6 Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1"); insert into t1 values ("-.1"),("+.1"),(".1");
Warnings: Warnings:
...@@ -281,7 +280,6 @@ drop table t1; ...@@ -281,7 +280,6 @@ drop table t1;
create table t1 (a decimal(10,2) zerofill); create table t1 (a decimal(10,2) zerofill);
insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0"); insert into t1 values ("0.0"),("-0.0"),("+0.0"),("01.0"),("+01.0"),("-01.0");
Warnings: Warnings:
Warning 1264 Out of range value for column 'a' at row 2
Warning 1264 Out of range value for column 'a' at row 6 Warning 1264 Out of range value for column 'a' at row 6
insert into t1 values ("-.1"),("+.1"),(".1"); insert into t1 values ("-.1"),("+.1"),(".1");
Warnings: Warnings:
......
...@@ -928,6 +928,8 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed) ...@@ -928,6 +928,8 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed)
error= decimal_shift(to, (int) exponent); error= decimal_shift(to, (int) exponent);
} }
} }
if (to->sign && decimal_is_zero(to))
to->sign= 0;
return error; return error;
fatal_error: fatal_error:
......
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