summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/suite/innodb/r/innodb-autoinc.result6
-rw-r--r--mysql-test/suite/innodb/t/innodb-autoinc.test5
-rw-r--r--sql/field.cc9
3 files changed, 19 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-autoinc.result b/mysql-test/suite/innodb/r/innodb-autoinc.result
index 9aa819de22b..4af674adc6a 100644
--- a/mysql-test/suite/innodb/r/innodb-autoinc.result
+++ b/mysql-test/suite/innodb/r/innodb-autoinc.result
@@ -1360,3 +1360,9 @@ SELECT * FROM t1;
c1
1e19
DROP TABLE t1;
+CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-1);
+SELECT * FROM t1;
+a
+-1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb-autoinc.test b/mysql-test/suite/innodb/t/innodb-autoinc.test
index ebb6a5d24ff..9835a9779cf 100644
--- a/mysql-test/suite/innodb/t/innodb-autoinc.test
+++ b/mysql-test/suite/innodb/t/innodb-autoinc.test
@@ -692,3 +692,8 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES ();
SELECT * FROM t1;
DROP TABLE t1;
+
+CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (-1);
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/sql/field.cc b/sql/field.cc
index a3c20ec18f2..f4aaaca69d6 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4399,7 +4399,14 @@ longlong Field_double::val_int_from_real(bool want_unsigned_result)
float8get(j,ptr);
res= double_to_longlong(j, want_unsigned_result, &error);
- if (error)
+ /*
+ Note, val_uint() is currently used for auto_increment purposes only,
+ and we want to suppress all warnings in such cases.
+ If we ever start using val_uint() for other purposes,
+ val_int_from_real() will need a new separate parameter to
+ suppress warnings.
+ */
+ if (error && !want_unsigned_result)
{
ErrConvDouble err(j);
push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,