List:Commits« Previous MessageNext Message »
From:<gshchepa Date:September 5 2007 12:14pm
Subject:bk commit into 5.0 tree (gshchepa:1.2509) BUG#27695
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of uchum. When uchum 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, 2007-09-05 17:14:11+05:00, gshchepa@stripped +4 -0
  Fixed bug #27695.
  Declaring an all space column name in the SELECT FROM DUAL or in a view
  leads to truncation of that name to empty string identifier.
  
  (This bug doesn't affect table column names because all space names
  are incorrect table column names.)
  
  The Item::set_name method has been modified to truncate such identifiers to
  the last character of the original string.

  mysql-test/r/mysql.result@stripped, 2007-09-05 16:58:31+05:00, gshchepa@stripped +8 -8
    Updated test case for bug  #27695.

  mysql-test/r/select.result@stripped, 2007-09-05 16:58:24+05:00, gshchepa@stripped +30 -0
    Added test case for bug #27695.

  mysql-test/t/select.test@stripped, 2007-09-05 16:58:10+05:00, gshchepa@stripped +20 -0
    Added test case for bug #27695.

  sql/item.cc@stripped, 2007-09-05 16:58:03+05:00, gshchepa@stripped +1 -1
    Fixed bug #27695.
    The Item::set_name method truncated an all space identifier to
    an empty string identifier.
    This method has been modified to truncate such identifiers to
    the last character of an original string.

diff -Nrup a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result
--- a/mysql-test/r/mysql.result	2007-04-23 15:58:34 +05:00
+++ b/mysql-test/r/mysql.result	2007-09-05 16:58:31 +05:00
@@ -2,33 +2,33 @@ drop table if exists t1;
 create table t1(a int);
 insert into t1 values(1);
 ERROR at line 9: DELIMITER must be followed by a 'delimiter' character or string
-
+ 
 Test default delimiter ;
 a
 1
-
+ 
 Test delimiter without arg
-
+ 
 Test delimiter :
 a
 1
-
+ 
 Test delimiter :
 a
 1
-
+ 
 Test delimiter :;
 a
 1
-
+ 
 Test delimiter //
 a
 1
-
+ 
 Test delimiter MySQL
 a
 1
-
+ 
 Test delimiter delimiter
 a
 1
diff -Nrup a/mysql-test/r/select.result b/mysql-test/r/select.result
--- a/mysql-test/r/select.result	2007-08-15 22:24:05 +05:00
+++ b/mysql-test/r/select.result	2007-09-05 16:58:24 +05:00
@@ -4062,4 +4062,34 @@ SHOW WARNINGS;
 Level	Code	Message
 Note	1003	select '0' AS `c1` from `test`.`t1` `join_0` join `test`.`t1` `join_1` join `test`.`t1` `join_2` join `test`.`t1` `join_3` join `test`.`t1` `join_4` join `test`.`t1` `join_5` join `test`.`t1` `join_6` join `test`.`t1` `join_7` where 0 group by '0','0','0','0','0'
 DROP TABLE t1;
+SELECT 1 AS ` `;
+ 
+1
+SELECT 1 AS `  `;
+ 
+1
+Warnings:
+Warning	1466	Leading spaces are removed from name '  '
+SELECT 1 AS ` x`;
+x
+1
+Warnings:
+Warning	1466	Leading spaces are removed from name ' x'
+CREATE VIEW v1 AS SELECT 1 AS ` `;
+SELECT ` ` FROM v1;
+ 
+1
+CREATE VIEW v2 AS SELECT 1 AS `  `;
+Warnings:
+Warning	1466	Leading spaces are removed from name '  '
+SELECT ` ` FROM v2;
+ 
+1
+CREATE VIEW v3 AS SELECT 1 AS ` x`;
+Warnings:
+Warning	1466	Leading spaces are removed from name ' x'
+SELECT `x` FROM v3;
+x
+1
+DROP VIEW v1, v2, v3;
 End of 5.0 tests
diff -Nrup a/mysql-test/t/select.test b/mysql-test/t/select.test
--- a/mysql-test/t/select.test	2007-08-15 22:24:05 +05:00
+++ b/mysql-test/t/select.test	2007-09-05 16:58:10 +05:00
@@ -3460,4 +3460,24 @@ SHOW WARNINGS;
 
 DROP TABLE t1;
 
+#
+# Bug #27695: Misleading warning when declaring all space column names and
+#             truncation of one-space column names to zero length names.
+#
+
+SELECT 1 AS ` `;
+SELECT 1 AS `  `;
+SELECT 1 AS ` x`;
+
+CREATE VIEW v1 AS SELECT 1 AS ` `;
+SELECT ` ` FROM v1;
+
+CREATE VIEW v2 AS SELECT 1 AS `  `;
+SELECT ` ` FROM v2;
+
+CREATE VIEW v3 AS SELECT 1 AS ` x`;
+SELECT `x` FROM v3;
+
+DROP VIEW v1, v2, v3;
+
 --echo End of 5.0 tests
diff -Nrup a/sql/item.cc b/sql/item.cc
--- a/sql/item.cc	2007-08-21 01:09:20 +05:00
+++ b/sql/item.cc	2007-09-05 16:58:03 +05:00
@@ -694,7 +694,7 @@ void Item::set_name(const char *str, uin
       This will probably need a better implementation in the future:
       a function in CHARSET_INFO structure.
     */
-    while (length && !my_isgraph(cs,*str))
+    while (length > 1 && !my_isgraph(cs,*str))
     {						// Fix problem with yacc
       length--;
       str++;
Thread
bk commit into 5.0 tree (gshchepa:1.2509) BUG#27695gshchepa5 Sep