summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-01-18 11:39:10 -0800
committerunknown <jimw@mysql.com>2005-01-18 11:39:10 -0800
commit803774958cb576e04213fd9ab14e78d1b588f8fd (patch)
treeeb2e6e68f15dee5f06afada78a5f1c57ab598bd7
parent9ed0d855502adec04e088d2f6f1b3bf58dca44d5 (diff)
parentdd68385435e0e7df27b26a8cc13c21195bedbcd9 (diff)
downloadmariadb-git-803774958cb576e04213fd9ab14e78d1b588f8fd.tar.gz
Merge mysql.com:/home/jimw/my/mysql-4.0-7700
into mysql.com:/home/jimw/my/mysql-4.0-clean
-rw-r--r--mysql-test/r/type_float.result7
-rw-r--r--mysql-test/t/type_float.test6
-rw-r--r--sql/field_conv.cc1
3 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/r/type_float.result b/mysql-test/r/type_float.result
index f4c5df353a3..4637a593e6c 100644
--- a/mysql-test/r/type_float.result
+++ b/mysql-test/r/type_float.result
@@ -120,3 +120,10 @@ drop table t1;
create table t1 (f float(54));
Incorrect column specifier for column 'f'
drop table if exists t1;
+create table t1 (d1 double, d2 double unsigned);
+insert into t1 set d1 = -1.0;
+update t1 set d2 = d1;
+select * from t1;
+d1 d2
+-1 0
+drop table t1;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index 084d4b815e5..2db6a79ff54 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -67,3 +67,9 @@ drop table t1;
create table t1 (f float(54)); # Should give an error
drop table if exists t1;
+# Don't allow 'double unsigned' to be set to a negative value (Bug #7700)
+create table t1 (d1 double, d2 double unsigned);
+insert into t1 set d1 = -1.0;
+update t1 set d2 = d1;
+select * from t1;
+drop table t1;
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index db0cc71c6bf..7aaabde4f55 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -537,6 +537,7 @@ void field_conv(Field *to,Field *from)
if (to->real_type() == from->real_type())
{
if (to->pack_length() == from->pack_length() &&
+ !(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) &&
to->real_type() != FIELD_TYPE_ENUM &&
to->real_type() != FIELD_TYPE_SET &&
to->table->db_low_byte_first == from->table->db_low_byte_first)