MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:antony Date:August 27 2005 6:26am
Subject:bk commit into 5.0 tree (acurtis:1.1900) BUG#9048
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of antony. When antony 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.1900 05/08/27 07:26:14 acurtis@stripped +3 -0
  Bug#9048
    "Creating a function with char binary IN parameter fails"
    Parse BINARY as part of type declaration, not as 
    a column attribute.

  sql/sql_yacc.yy
    1.419 05/08/27 07:25:47 acurtis@stripped +23 -5
    fix bug 9048
    parse BINARY as part of type declaration and not as column modifier.

  mysql-test/t/sp.test
    1.142 05/08/27 07:25:47 acurtis@stripped +13 -0
    test for bug 9048

  mysql-test/r/sp.result
    1.147 05/08/27 07:25:47 acurtis@stripped +7 -0
    test for bug 9048

# 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:	acurtis
# Host:	ltantony.xiphis.org
# Root:	/usr/home/antony/work2/p3-bug9048.2

--- 1.418/sql/sql_yacc.yy	2005-08-25 14:39:01 +01:00
+++ 1.419/sql/sql_yacc.yy	2005-08-27 07:25:47 +01:00
@@ -2874,10 +2874,10 @@
 					  $$=FIELD_TYPE_STRING; }
 	| char opt_binary		{ Lex->length=(char*) "1";
 					  $$=FIELD_TYPE_STRING; }
-	| nchar '(' NUM ')'		{ Lex->length=$3.str;
+	| nchar '(' NUM ')' opt_bin_mod	{ Lex->length=$3.str;
 					  $$=FIELD_TYPE_STRING;
 					  Lex->charset=national_charset_info; }
-	| nchar				{ Lex->length=(char*) "1";
+	| nchar opt_bin_mod		{ Lex->length=(char*) "1";
 					  $$=FIELD_TYPE_STRING;
 					  Lex->charset=national_charset_info; }
 	| BINARY '(' NUM ')'		{ Lex->length=$3.str;
@@ -2888,7 +2888,7 @@
 					  $$=FIELD_TYPE_STRING; }
 	| varchar '(' NUM ')' opt_binary { Lex->length=$3.str;
 					  $$= MYSQL_TYPE_VARCHAR; }
-	| nvarchar '(' NUM ')'		{ Lex->length=$3.str;
+	| nvarchar '(' NUM ')' opt_bin_mod { Lex->length=$3.str;
 					  $$= MYSQL_TYPE_VARCHAR;
 					  Lex->charset=national_charset_info; }
 	| VARBINARY '(' NUM ')' 	{ Lex->length=$3.str;
@@ -3077,7 +3077,6 @@
 	    lex->alter_info.flags|= ALTER_ADD_INDEX; 
 	  }
 	| COMMENT_SYM TEXT_STRING_sys { Lex->comment= $2; }
-	| BINARY { Lex->type|= BINCMP_FLAG; }
 	| COLLATE_SYM collation_name
 	  {
 	    if (Lex->charset && !my_charset_same(Lex->charset,$2))
@@ -3162,8 +3161,27 @@
 
 opt_binary:
 	/* empty */			{ Lex->charset=NULL; }
-	| ASCII_SYM			{ Lex->charset=&my_charset_latin1; }
+	| ASCII_SYM opt_bin_mod		{ Lex->charset=&my_charset_latin1; }
 	| BYTE_SYM			{ Lex->charset=&my_charset_bin; }
+	| UNICODE_SYM opt_bin_mod
+	{
+	  if (!(Lex->charset=get_charset_by_csname("ucs2",
+                                                   MY_CS_PRIMARY,MYF(0))))
+	  {
+	    my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
+	    YYABORT;
+	  }
+	}
+	| charset charset_name opt_bin_mod	{ Lex->charset=$2; }
+        | BINARY opt_bin_charset { Lex->type|= BINCMP_FLAG; };
+
+opt_bin_mod:
+	/* empty */ { }
+	| BINARY { Lex->type|= BINCMP_FLAG; };
+
+opt_bin_charset:
+	/* empty */ { }
+	| ASCII_SYM	{ Lex->charset=&my_charset_latin1; }
 	| UNICODE_SYM
 	{
 	  if (!(Lex->charset=get_charset_by_csname("ucs2",

--- 1.146/mysql-test/r/sp.result	2005-08-25 12:53:01 +01:00
+++ 1.147/mysql-test/r/sp.result	2005-08-27 07:25:47 +01:00
@@ -3186,4 +3186,11 @@
 call bug11333(10)|
 drop procedure bug11333|
 drop table t3|
+drop function if exists bug9048|
+create function bug9048(f1 char binary) returns char binary
+begin
+set f1= concat( 'hello', f1 );
+return f1;
+end|
+drop function bug9048|
 drop table t1,t2;

--- 1.141/mysql-test/t/sp.test	2005-08-25 12:53:01 +01:00
+++ 1.142/mysql-test/t/sp.test	2005-08-27 07:25:47 +01:00
@@ -4031,6 +4031,19 @@
 drop table t3|
 
 #
+# BUG#9048: Creating a function with char binary IN parameter fails
+#
+--disable_warnings
+drop function if exists bug9048|
+--enable_warnings
+create function bug9048(f1 char binary) returns char binary
+begin
+  set f1= concat( 'hello', f1 );
+  return f1;
+end|
+drop function bug9048|
+
+#
 # BUG#NNNN: New bug synopsis
 #
 #--disable_warnings
Thread
bk commit into 5.0 tree (acurtis:1.1900) BUG#9048antony27 Aug