List:Commits« Previous MessageNext Message »
From:Jim Winstead Date:July 12 2006 10:22pm
Subject:bk commit into 5.0 tree (jimw:1.2234) BUG#17903
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw 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-12 13:22:38-07:00, jimw@rama.(none) +3 -0
  Bug #17903: cast to char results in binary
  
    The character set was not being properly initialized in CAST() with
    a type like "CHAR(2) BINARY", which resulted in incorrect results or
    even a crash.

  mysql-test/r/cast.result@stripped, 2006-07-12 13:22:35-07:00, jimw@rama.(none) +11 -0
    Add new results

  mysql-test/t/cast.test@stripped, 2006-07-12 13:22:36-07:00, jimw@rama.(none) +13 -1
    Add new regression test

  sql/sql_yacc.yy@stripped, 2006-07-12 13:22:36-07:00, jimw@rama.(none) +1 -1
    Make sure Lex->charset is set to NULL when nothing follows BINARY
    in type declaration.

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-17903

--- 1.474/sql/sql_yacc.yy	2006-07-12 13:22:42 -07:00
+++ 1.475/sql/sql_yacc.yy	2006-07-12 13:22:42 -07:00
@@ -3089,7 +3089,7 @@
 	| BINARY { Lex->type|= BINCMP_FLAG; };
 
 opt_bin_charset:
-	/* empty */ { }
+        /* empty */ { Lex->charset= NULL; }
 	| ASCII_SYM	{ Lex->charset=&my_charset_latin1; }
 	| UNICODE_SYM
 	{

--- 1.45/mysql-test/r/cast.result	2006-07-12 13:22:42 -07:00
+++ 1.46/mysql-test/r/cast.result	2006-07-12 13:22:42 -07:00
@@ -381,3 +381,14 @@
 select cast(NULL as decimal(6)) as t1;
 t1
 NULL
+set names latin1;
+select hex(cast('a' as char(2) binary));
+hex(cast('a' as char(2) binary))
+61
+select hex(cast('a' as binary(2)));
+hex(cast('a' as binary(2)))
+6100
+select hex(cast('a' as char(2) binary));
+hex(cast('a' as char(2) binary))
+61
+End of 5.0 tests

--- 1.31/mysql-test/t/cast.test	2006-07-12 13:22:42 -07:00
+++ 1.32/mysql-test/t/cast.test	2006-07-12 13:22:42 -07:00
@@ -204,7 +204,19 @@
        CAST(mt AS DECIMAL), CAST(lt AS DECIMAL) from t1;
 
 DROP TABLE t1;
-# Bug @10237 (CAST(NULL DECIMAL) crashes server)
+
+#
+# Bug #10237 (CAST(NULL DECIMAL) crashes server)
 #
 select cast(NULL as decimal(6)) as t1;
 
+
+#
+# Bug #17903: cast to char results in binary
+#
+set names latin1;
+select hex(cast('a' as char(2) binary));
+select hex(cast('a' as binary(2)));
+select hex(cast('a' as char(2) binary));
+
+--echo End of 5.0 tests
Thread
bk commit into 5.0 tree (jimw:1.2234) BUG#17903Jim Winstead12 Jul