MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:ramil Date:May 13 2005 8:22am
Subject:bk commit into 5.0 tree (ramil:1.1943) BUG#6961
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1943 05/05/13 13:22:27 ramil@stripped +3 -0
  a fix (bug #6961: Traditional: assignment of string to numeric column should fail).

  sql/field.cc
    1.260 05/05/13 13:22:22 ramil@stripped +14 -3
    a fix (bug #6961: Traditional: assignment of string to numeric column should fail).
    Should issue errors in strict modes instead of warnings.

  mysql-test/t/strict.test
    1.13 05/05/13 13:22:21 ramil@stripped +2 -2
    a fix (bug #6961: Traditional: assignment of string to numeric column should fail).

  mysql-test/r/strict.result
    1.18 05/05/13 13:22:21 ramil@stripped +2 -4
    a fix (bug #6961: Traditional: assignment of string to numeric column should fail).

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ramil
# Host:	gw.mysql.r18.ru
# Root:	/usr/home/ram/work/5.0.b6961

--- 1.259/sql/field.cc	2005-05-12 19:36:29 +05:00
+++ 1.260/sql/field.cc	2005-05-13 13:22:22 +05:00
@@ -2365,9 +2365,20 @@
   my_decimal decimal_value;
   DBUG_ENTER("Field_new_decimal::store(char*)");
 
-  switch ((err= str2my_decimal(E_DEC_FATAL_ERROR &
-                               ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
-                               from, length, charset,  &decimal_value))) {
+  if ((err= str2my_decimal(E_DEC_FATAL_ERROR &
+                      ~(E_DEC_OVERFLOW | E_DEC_BAD_NUM),
+                      from, length, charset,  &decimal_value)) &&
+      table->in_use->abort_on_warning)
+  {
+    push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_ERROR,
+                        ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
+                        ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+                        "decimal", from, field_name,
+                        (ulong) table->in_use->row_count);
+    DBUG_RETURN(err);
+  }
+
+  switch (err) {
   case E_DEC_TRUNCATED:
     set_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
     break;

--- 1.17/mysql-test/r/strict.result	2005-05-12 15:55:09 +05:00
+++ 1.18/mysql-test/r/strict.result	2005-05-13 13:22:21 +05:00
@@ -770,7 +770,7 @@
 INSERT INTO t1 VALUES ('-100E+1');
 ERROR 22003: Out of range value adjusted for column 'col1' at row 1
 INSERT INTO t1 VALUES ('-100E');
-ERROR 22003: Out of range value adjusted for column 'col1' at row 1
+ERROR HY000: Incorrect decimal value: '-100E' for column 'col1' at row 1
 UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
 ERROR 22003: Out of range value adjusted for column 'col1' at row 6
 UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
@@ -782,8 +782,7 @@
 INSERT INTO t1 (col1) VALUES ('a59b');
 ERROR HY000: Incorrect decimal value: 'a59b' for column 'col1' at row 1
 INSERT INTO t1 (col1) VALUES ('1a');
-Warnings:
-Note	1265	Data truncated for column 'col1' at row 1
+ERROR HY000: Incorrect decimal value: '1a' for column 'col1' at row 1
 INSERT IGNORE INTO t1 (col1) VALUES ('2a');
 Warnings:
 Note	1265	Data truncated for column 'col1' at row 1
@@ -818,7 +817,6 @@
 -10.56
 11.00
 10.00
-1.00
 2.00
 NULL
 99.99

--- 1.12/mysql-test/t/strict.test	2005-05-12 15:55:09 +05:00
+++ 1.13/mysql-test/t/strict.test	2005-05-13 13:22:21 +05:00
@@ -740,7 +740,7 @@
 INSERT INTO t1 VALUES ('-1010.55');
 --error 1264
 INSERT INTO t1 VALUES ('-100E+1');
---error 1264
+--error 1366
 INSERT INTO t1 VALUES ('-100E');
 --error 1264
 UPDATE t1 SET col1 =col1 * 50000 WHERE col1 =11;
@@ -754,7 +754,7 @@
 #--error 1265
 --error 1366
 INSERT INTO t1 (col1) VALUES ('a59b');
-#--error 1265
+--error 1366
 INSERT INTO t1 (col1) VALUES ('1a');
 INSERT IGNORE INTO t1 (col1) VALUES ('2a');
 INSERT IGNORE INTO t1 values (1/0);
Thread
bk commit into 5.0 tree (ramil:1.1943) BUG#6961ramil13 May