List:Commits« Previous MessageNext Message »
From:<gshchepa Date:May 6 2008 4:43pm
Subject:bk commit into 5.0 tree (gshchepa:1.2623) BUG#30059
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of gshchepa.  When gshchepa 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@stripped, 2008-05-06 21:43:46+05:00, gshchepa@stripped +9 -0
  Partial rollback of fix for bug #30059: End-space truncation is inconsistent
  or incorrect.
  
  For better conformance with standard, truncation procedure of CHAR columns
  has been changed to ignore truncation of trailing whitespace characters
  (note has been removed).
  
  Finally, for columns with non-binary charsets:
  
  1. CHAR(N) columns silently ignore trailing whitespace truncation;
  2. VARCHAR and TEXT columns issue Note about truncation.
  
  BLOBs and other columns with BINARY charset are unaffected.
  
  
  

  mysql-test/r/bdb.result@stripped, 2008-05-06 21:01:56+05:00, gshchepa@stripped +0 -1
    Rollback of bug #30059 fix.

  mysql-test/r/heap.result@stripped, 2008-05-06 21:01:58+05:00, gshchepa@stripped +0 -1
    Rollback of bug #30059 fix.

  mysql-test/r/innodb.result@stripped, 2008-05-06 21:01:58+05:00, gshchepa@stripped +0 -1
    Rollback of bug #30059 fix.

  mysql-test/r/myisam.result@stripped, 2008-05-06 21:01:59+05:00, gshchepa@stripped +0 -1
    Rollback of bug #30059 fix.

  mysql-test/r/strict.result@stripped, 2008-05-06 21:01:59+05:00, gshchepa@stripped +0 -2
    Rollback of bug #30059 fix.

  mysql-test/r/type_binary.result@stripped, 2008-05-06 21:01:59+05:00, gshchepa@stripped +0 -1
    Rollback of bug #30059 fix.

  mysql-test/r/warnings.result@stripped, 2008-05-06 21:02:01+05:00, gshchepa@stripped +0 -2
    Updated test case for bug #30059.

  sql/field.cc@stripped, 2008-05-06 21:02:01+05:00, gshchepa@stripped +12 -6
    Post-commit fix for bug #30059.
    
    The Field_longstr::report_if_important_data method
    has been changed to notify about trailing spaces only if
    the new count_spaces parameter is TRUE.
    
    The Field_string::store method has been changed to
    ignore trailing whitespace truncation (CHAR column
    type).

  sql/field.h@stripped, 2008-05-06 21:02:02+05:00, gshchepa@stripped +2 -1
    Post-commit fix for bug #30059.
    
    The Field_longstr::report_if_important_data method declaration
    has been changed to accept extra parameter: bool count_spaces.

diff -Nrup a/mysql-test/r/bdb.result b/mysql-test/r/bdb.result
--- a/mysql-test/r/bdb.result	2008-02-07 04:54:13 +04:00
+++ b/mysql-test/r/bdb.result	2008-05-06 21:01:56 +05:00
@@ -1325,7 +1325,6 @@ set @a=repeat(' ',20);
 insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
 Warnings:
 Note	1265	Data truncated for column 'v' at row 1
-Note	1265	Data truncated for column 'c' at row 1
 select concat('*',v,'*',c,'*',t,'*') from t1;
 concat('*',v,'*',c,'*',t,'*')
 *+ *+*+ *
diff -Nrup a/mysql-test/r/heap.result b/mysql-test/r/heap.result
--- a/mysql-test/r/heap.result	2008-02-07 02:32:57 +04:00
+++ b/mysql-test/r/heap.result	2008-05-06 21:01:58 +05:00
@@ -256,7 +256,6 @@ set @a=repeat(' ',20);
 insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
 Warnings:
 Note	1265	Data truncated for column 'v' at row 1
-Note	1265	Data truncated for column 'c' at row 1
 select concat('*',v,'*',c,'*',t,'*') from t1;
 concat('*',v,'*',c,'*',t,'*')
 *+ *+*+ *
diff -Nrup a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
--- a/mysql-test/r/innodb.result	2008-02-07 02:32:59 +04:00
+++ b/mysql-test/r/innodb.result	2008-05-06 21:01:58 +05:00
@@ -1901,7 +1901,6 @@ set @a=repeat(' ',20);
 insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
 Warnings:
 Note	1265	Data truncated for column 'v' at row 1
-Note	1265	Data truncated for column 'c' at row 1
 select concat('*',v,'*',c,'*',t,'*') from t1;
 concat('*',v,'*',c,'*',t,'*')
 *+ *+*+ *
diff -Nrup a/mysql-test/r/myisam.result b/mysql-test/r/myisam.result
--- a/mysql-test/r/myisam.result	2008-03-15 21:51:30 +04:00
+++ b/mysql-test/r/myisam.result	2008-05-06 21:01:59 +05:00
@@ -1104,7 +1104,6 @@ set @a=repeat(' ',20);
 insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
 Warnings:
 Note	1265	Data truncated for column 'v' at row 1
-Note	1265	Data truncated for column 'c' at row 1
 select concat('*',v,'*',c,'*',t,'*') from t1;
 concat('*',v,'*',c,'*',t,'*')
 *+ *+*+ *
diff -Nrup a/mysql-test/r/strict.result b/mysql-test/r/strict.result
--- a/mysql-test/r/strict.result	2008-02-07 02:33:00 +04:00
+++ b/mysql-test/r/strict.result	2008-05-06 21:01:59 +05:00
@@ -934,8 +934,6 @@ NULL	NULL
 DROP TABLE t1;
 CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
 INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello   ', 'hello ');
-Warnings:
-Note	1265	Data truncated for column 'col1' at row 3
 INSERT INTO t1 (col1) VALUES ('hellobob');
 ERROR 22001: Data too long for column 'col1' at row 1
 INSERT INTO t1 (col2) VALUES ('hellobob');
diff -Nrup a/mysql-test/r/type_binary.result b/mysql-test/r/type_binary.result
--- a/mysql-test/r/type_binary.result	2008-02-07 02:33:00 +04:00
+++ b/mysql-test/r/type_binary.result	2008-05-06 21:01:59 +05:00
@@ -125,7 +125,6 @@ create table t1 (c char(2), vc varchar(2
 insert into t1 values(0x4120, 0x4120);
 insert into t1 values(0x412020, 0x412020);
 Warnings:
-Note	1265	Data truncated for column 'c' at row 1
 Note	1265	Data truncated for column 'vc' at row 1
 drop table t1;
 set @old_sql_mode= @@sql_mode, sql_mode= 'traditional';
diff -Nrup a/mysql-test/r/warnings.result b/mysql-test/r/warnings.result
--- a/mysql-test/r/warnings.result	2008-02-07 02:33:01 +04:00
+++ b/mysql-test/r/warnings.result	2008-05-06 21:02:01 +05:00
@@ -305,7 +305,6 @@ set @q = repeat('q', 256);
 set sql_mode = '';
 insert into t1 values(@c, @c, @c);
 Warnings:
-Note	1265	Data truncated for column 'c_char' at row 1
 Note	1265	Data truncated for column 'c_varchar' at row 1
 Note	1265	Data truncated for column 'c_tinytext' at row 1
 insert into t2 values(@c);
@@ -322,7 +321,6 @@ Warning	1265	Data truncated for column '
 set sql_mode = 'traditional';
 insert into t1 values(@c, @c, @c);
 Warnings:
-Note	1265	Data truncated for column 'c_char' at row 1
 Note	1265	Data truncated for column 'c_varchar' at row 1
 Note	1265	Data truncated for column 'c_tinytext' at row 1
 insert into t2 values(@c);
diff -Nrup a/sql/field.cc b/sql/field.cc
--- a/sql/field.cc	2008-04-11 00:55:35 +05:00
+++ b/sql/field.cc	2008-05-06 21:02:01 +05:00
@@ -5868,6 +5868,7 @@ check_string_copy_error(Field_str *field
     Field_longstr::report_if_important_data()
     ptr                      - Truncated rest of string
     end                      - End of truncated string
+    count_spaces             - Treat traling spaces as important data
 
   RETURN VALUES
     0   - None was truncated (or we don't count cut fields)
@@ -5877,10 +5878,12 @@ check_string_copy_error(Field_str *field
     Check if we lost any important data (anything in a binary string,
     or any non-space in others). If only trailing spaces was lost,
     send a truncation note, otherwise send a truncation error.
+    Silently ignore traling spaces if the count_space parameter is FALSE.
 */
 
 int
-Field_longstr::report_if_important_data(const char *ptr, const char *end)
+Field_longstr::report_if_important_data(const char *ptr, const char *end,
+                                        bool count_spaces)
 {
   if ((ptr < end) && table->in_use->count_cuted_fields)
   {
@@ -5890,10 +5893,13 @@ Field_longstr::report_if_important_data(
         set_warning(MYSQL_ERROR::WARN_LEVEL_ERROR, ER_DATA_TOO_LONG, 1);
       else
         set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+      return 2;
     }
-    else /* If we lost only spaces then produce a NOTE, not a WARNING */
+    else if (count_spaces)
+    { /* If we lost only spaces then produce a NOTE, not a WARNING */
       set_warning(MYSQL_ERROR::WARN_LEVEL_NOTE, WARN_DATA_TRUNCATED, 1);
-    return 2;
+      return 2;
+    }
   }
   return 0;
 }
@@ -5929,7 +5935,7 @@ int Field_string::store(const char *from
                               cannot_convert_error_pos, from + length))
     return 2;
 
-  return report_if_important_data(from_end_pos, from + length);
+  return report_if_important_data(from_end_pos, from + length, FALSE);
 }
 
 
@@ -6388,7 +6394,7 @@ int Field_varstring::store(const char *f
                               cannot_convert_error_pos, from + length))
     return 2;
 
-  return report_if_important_data(from_end_pos, from + length);
+  return report_if_important_data(from_end_pos, from + length, TRUE);
 }
 
 
@@ -7025,7 +7031,7 @@ int Field_blob::store(const char *from,u
                               cannot_convert_error_pos, from + length))
     return 2;
 
-  return report_if_important_data(from_end_pos, from + length);
+  return report_if_important_data(from_end_pos, from + length, TRUE);
 
 oom_error:
   /* Fatal OOM error */
diff -Nrup a/sql/field.h b/sql/field.h
--- a/sql/field.h	2008-02-07 02:33:03 +04:00
+++ b/sql/field.h	2008-05-06 21:02:02 +05:00
@@ -455,7 +455,8 @@ public:
 class Field_longstr :public Field_str
 {
 protected:
-  int report_if_important_data(const char *ptr, const char *end);
+  int report_if_important_data(const char *ptr, const char *end,
+                               bool count_spaces);
 public:
   Field_longstr(char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
                 uchar null_bit_arg, utype unireg_check_arg,
Thread
bk commit into 5.0 tree (gshchepa:1.2623) BUG#30059gshchepa6 May