MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:eugene Date:July 14 2006 10:55pm
Subject:bk commit into 5.0 tree (evgen:1.2240) BUG#10977
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen 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, 2006-07-15 02:55:37+04:00, evgen@stripped +5 -0
  Fixed bug#10977: No warning issued if a column name is truncated
  
  When an alias is set to a column leading spaces are removed from the alias.
  This is done in order to produce correct auto-generated aliases. Also
  leading spaces are removed from aliases set by user and this can lead to
  confusion.
  
  Now Item::set_name() method issues the warning if leading spaces were removed
  from an alias set by user.
  
  New warning message is added.

  mysql-test/r/select.result@stripped, 2006-07-15 02:52:42+04:00, evgen@stripped +5 -0
    Added test case for bug#10977:No warning issued if a column name is truncated.

  mysql-test/t/select.test@stripped, 2006-07-15 02:52:11+04:00, evgen@stripped +5 -0
    Added test case for bug#10977:No warning issued if a column name is truncated.

  sql/item.cc@stripped, 2006-07-15 02:54:25+04:00, evgen@stripped +6 -0
    Fixed bug#10977: No warning issued if a column name is truncated
    Now Item::set_name() method issues the warning if leading spaces were removed
    from an alias set by user.

  sql/share/errmsg.txt@stripped, 2006-07-15 02:55:01+04:00, evgen@stripped +2 -0
    Fixed bug#10977: No warning issued if a column name is truncated
    New warning message is added.

  sql/sql_yacc.yy@stripped, 2006-07-15 02:53:09+04:00, evgen@stripped +2 -2
    Fixed bug#10977: No warning issued if a column name is truncated
    The is_autogenerated_name flag is set before set_name() method call.

# 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:	evgen
# Host:	moonbone.local
# Root:	/work/10977-bug-5.0-opt-mysql

--- 1.227/sql/item.cc	2006-07-15 02:55:42 +04:00
+++ 1.228/sql/item.cc	2006-07-15 02:55:42 +04:00
@@ -573,6 +573,7 @@
   }
   if (cs->ctype)
   {
+    uint orig_len= length;
     /*
       This will probably need a better implementation in the future:
       a function in CHARSET_INFO structure.
@@ -582,6 +583,11 @@
       length--;
       str++;
     }
+    if (orig_len != length && !is_autogenerated_name)
+      push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+                          ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES),
+                          str + length - orig_len);
+
   }
   if (!my_charset_same(cs, system_charset_info))
   {

--- 1.474/sql/sql_yacc.yy	2006-07-15 02:55:42 +04:00
+++ 1.475/sql/sql_yacc.yy	2006-07-15 02:55:42 +04:00
@@ -4060,8 +4060,8 @@
 	      YYABORT;
 	    if ($4.str)
             {
-	      $2->set_name($4.str, $4.length, system_charset_info);
               $2->is_autogenerated_name= FALSE;
+	      $2->set_name($4.str, $4.length, system_charset_info);
             }
 	    else if (!$2->name) {
 	      char *str = $1;
@@ -4936,8 +4936,8 @@
 	{
 	  if ($4.str)
           {
-	    $2->set_name($4.str, $4.length, system_charset_info);
             $2->is_autogenerated_name= FALSE;
+	    $2->set_name($4.str, $4.length, system_charset_info);
           }
 	  else
 	    $2->set_name($1, (uint) ($3 - $1), YYTHD->charset());

--- 1.65/sql/share/errmsg.txt	2006-07-15 02:55:42 +04:00
+++ 1.66/sql/share/errmsg.txt	2006-07-15 02:55:42 +04:00
@@ -5621,3 +5621,5 @@
         eng "The used table type doesn't support SPATIAL indexes"
 ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA
 	eng "Triggers can not be created on system tables"
+ER_REMOVED_SPACES
+        eng "Leading spaces are removed from name '%s'"

--- 1.131/mysql-test/r/select.result	2006-07-15 02:55:42 +04:00
+++ 1.132/mysql-test/r/select.result	2006-07-15 02:55:42 +04:00
@@ -3398,3 +3398,8 @@
 SELECT 0.9888889889 * 1.011111411911;
 0.9888889889 * 1.011111411911
 0.9998769417899202067879
+select 1 as ' a ';
+a 
+1
+Warnings:
+Warning	1466	Leading spaces are removed from name ' a '

--- 1.107/mysql-test/t/select.test	2006-07-15 02:55:42 +04:00
+++ 1.108/mysql-test/t/select.test	2006-07-15 02:55:42 +04:00
@@ -2906,3 +2906,8 @@
 # Bug #20569: Garbage in DECIMAL results from some mathematical functions
 #
 SELECT 0.9888889889 * 1.011111411911;
+
+#
+# Bug #10977: No warning issued if a column name is truncated
+#
+select 1 as ' a ';
Thread
bk commit into 5.0 tree (evgen:1.2240) BUG#10977eugene15 Jul