List:Internals« Previous MessageNext Message »
From:pem Date:July 8 2005 5:03pm
Subject:bk commit into 5.0 tree (pem:1.1900) BUG#11365
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of pem. When pem 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/07/08 16:33:15 pem@stripped +5 -0
  Fixed BUG#11365: Stored Procedure: Crash on Procedure operation
    Two separate problems. A key buffer was too small in sp.cc for multi-byte
    fields, and the creation and fixing of mysql.proc in the scripts hadn't been
    updated with the correct character sets and collations (like the other
    system tables had).
    Note: No special test case, as the use of utf8 for mysql.proc will make
    any existing crash (if the buffer overrrun wasn't fixed).

  sql/sp.cc
    1.80 05/07/08 16:33:09 pem@stripped +1 -1
    Use a larger key buffer for stored procedures to avoid stack overrun with multi-byte
keys.

  scripts/mysql_fix_privilege_tables.sql
    1.28 05/07/08 16:33:09 pem@stripped +29 -16
    Use utf8 for mysql.proc, just like for the other system tables.
    (Some tabs also replaced by space)

  scripts/mysql_create_system_tables.sh
    1.25 05/07/08 16:33:09 pem@stripped +7 -5
    Use utf8 for mysql.proc, just like for the other system tables.

  mysql-test/t/sp-error.test
    1.77 05/07/08 16:33:09 pem@stripped +2 -2
    Updated test case for too long SP names (as the limit has increased with the use of
utf8).

  mysql-test/r/sp-error.result
    1.74 05/07/08 16:33:09 pem@stripped +2 -2
    Updated test case for too long SP names (as the limit has increased with the use of
utf8).

# 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:	pem
# Host:	mysql.comhem.se
# Root:	/home/pem/work/mysql-5.0

--- 1.27/scripts/mysql_fix_privilege_tables.sql	2005-07-05 12:36:32 +02:00
+++ 1.28/scripts/mysql_fix_privilege_tables.sql	2005-07-08 16:33:09 +02:00
@@ -412,22 +412,22 @@
 #
 
 CREATE TABLE IF NOT EXISTS proc (
-  db                char(64) binary DEFAULT '' NOT NULL,
+  db                char(64) collate utf8_bin DEFAULT '' NOT NULL,
   name              char(64) DEFAULT '' NOT NULL,
   type              enum('FUNCTION','PROCEDURE') NOT NULL,
   specific_name     char(64) DEFAULT '' NOT NULL,
   language          enum('SQL') DEFAULT 'SQL' NOT NULL,
   sql_data_access   enum('CONTAINS_SQL',
-			 'NO_SQL',
-			 'READS_SQL_DATA',
-			 'MODIFIES_SQL_DATA'
-		    ) DEFAULT 'CONTAINS_SQL' NOT NULL,
+                         'NO_SQL',
+                         'READS_SQL_DATA',
+                         'MODIFIES_SQL_DATA'
+                    ) DEFAULT 'CONTAINS_SQL' NOT NULL,
   is_deterministic  enum('YES','NO') DEFAULT 'NO' NOT NULL,
   security_type     enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL,
   param_list        blob DEFAULT '' NOT NULL,
   returns           char(64) DEFAULT '' NOT NULL,
   body              blob DEFAULT '' NOT NULL,
-  definer           char(77) binary DEFAULT '' NOT NULL,
+  definer           char(77) collate utf8_bin DEFAULT '' NOT NULL,
   created           timestamp,
   modified          timestamp,
   sql_mode          set(
@@ -461,20 +461,22 @@
                         'TRADITIONAL',
                         'NO_AUTO_CREATE_USER',
                         'HIGH_NOT_PRECEDENCE'
-                    ) DEFAULT 0 NOT NULL,
-  comment           char(64) binary DEFAULT '' NOT NULL,
+                    ) DEFAULT '' NOT NULL,
+  comment           char(64) collate utf8_bin DEFAULT '' NOT NULL,
   PRIMARY KEY (db,name,type)
-) comment='Stored Procedures';
+) engine=MyISAM
+  character set utf8
+  comment='Stored Procedures';
 
 # Correct the name fields to not binary, and expand sql_data_access
 ALTER TABLE proc MODIFY name char(64) DEFAULT '' NOT NULL,
                  MODIFY specific_name char(64) DEFAULT '' NOT NULL,
-		 MODIFY sql_data_access
-			enum('CONTAINS_SQL',
-			     'NO_SQL',
-			     'READS_SQL_DATA',
-			     'MODIFIES_SQL_DATA'
-			    ) DEFAULT 'CONTAINS_SQL' NOT NULL,
+                 MODIFY sql_data_access
+                        enum('CONTAINS_SQL',
+                             'NO_SQL',
+                             'READS_SQL_DATA',
+                             'MODIFIES_SQL_DATA'
+                            ) DEFAULT 'CONTAINS_SQL' NOT NULL,
                  MODIFY sql_mode
                         set('REAL_AS_FLOAT',
                             'PIPES_AS_CONCAT',
@@ -506,4 +508,15 @@
                             'TRADITIONAL',
                             'NO_AUTO_CREATE_USER',
                             'HIGH_NOT_PRECEDENCE'
-                            ) DEFAULT 0 NOT NULL;
+                            ) DEFAULT '' NOT NULL
+                 DEFAULT CHARACTER SET utf8;
+
+# Correct the character set and collation
+ALTER TABLE proc CONVERT TO CHARACTER SET utf8;
+# Reset some fields after the conversion
+ALTER TABLE proc  MODIFY db
+                         char(64) collate utf8_bin DEFAULT '' NOT NULL,
+                  MODIFY definer
+                         char(77) collate utf8_bin DEFAULT '' NOT NULL,
+                  MODIFY comment
+                         char(64) collate utf8_bin DEFAULT '' NOT NULL;

--- 1.73/mysql-test/r/sp-error.result	2005-07-06 08:21:23 +02:00
+++ 1.74/mysql-test/r/sp-error.result	2005-07-08 16:33:09 +02:00
@@ -604,10 +604,10 @@
 return 5;
 end|
 ERROR 0A000: FLUSH is not allowed in stored procedures
-create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890()
+create procedure
bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123()
 begin
 end|
-ERROR 42000: Identifier name
'bug9529_90123456789012345678901234567890123456789012345678901234567890' is too long
+ERROR 42000: Identifier name
'bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'
is too long
 drop procedure if exists bug10969|
 create procedure bug10969()
 begin

--- 1.76/mysql-test/t/sp-error.test	2005-07-06 09:33:22 +02:00
+++ 1.77/mysql-test/t/sp-error.test	2005-07-08 16:33:09 +02:00
@@ -874,9 +874,9 @@
 #
 # BUG#9529: Stored Procedures: No Warning on truncation of procedure name
 #           during creation.
-#
+# Note: When using utf8 for mysql.proc, this limit is much higher than before
 --error ER_TOO_LONG_IDENT
-create procedure bug9529_90123456789012345678901234567890123456789012345678901234567890()
+create procedure
bug9529_90123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123()
 begin
 end|
 

--- 1.79/sql/sp.cc	2005-07-02 23:50:58 +02:00
+++ 1.80/sql/sp.cc	2005-07-08 16:33:09 +02:00
@@ -67,7 +67,7 @@
 		    enum thr_lock_type ltype, TABLE **tablep, bool *opened)
 {
   TABLE *table;
-  byte key[NAME_LEN*2+4+1];	// db, name, optional key length type
+  byte key[MAX_KEY_LENGTH];	// db, name, optional key length type
   DBUG_ENTER("db_find_routine_aux");
   DBUG_PRINT("enter", ("type: %d name: %*s",
 		       type, name->m_name.length, name->m_name.str));

--- 1.24/scripts/mysql_create_system_tables.sh	2005-07-05 12:36:31 +02:00
+++ 1.25/scripts/mysql_create_system_tables.sh	2005-07-08 16:33:09 +02:00
@@ -669,7 +669,7 @@
 if test ! -f $mdata/proc.frm
 then
   c_p="$c_p CREATE TABLE proc ("
-  c_p="$c_p   db                char(64) binary DEFAULT '' NOT NULL,"
+  c_p="$c_p   db                char(64) collate utf8_bin DEFAULT '' NOT NULL,"
   c_p="$c_p   name              char(64) DEFAULT '' NOT NULL,"
   c_p="$c_p   type              enum('FUNCTION','PROCEDURE') NOT NULL,"
   c_p="$c_p   specific_name     char(64) DEFAULT '' NOT NULL,"
@@ -684,7 +684,7 @@
   c_p="$c_p   param_list        blob DEFAULT '' NOT NULL,"
   c_p="$c_p   returns           char(64) DEFAULT '' NOT NULL,"
   c_p="$c_p   body              blob DEFAULT '' NOT NULL,"
-  c_p="$c_p   definer           char(77) binary DEFAULT '' NOT NULL,"
+  c_p="$c_p   definer           char(77) collate utf8_bin DEFAULT '' NOT NULL,"
   c_p="$c_p   created           timestamp,"
   c_p="$c_p   modified          timestamp,"
   c_p="$c_p   sql_mode          set("
@@ -718,10 +718,12 @@
   c_p="$c_p                         'TRADITIONAL',"
   c_p="$c_p                         'NO_AUTO_CREATE_USER',"
   c_p="$c_p                         'HIGH_NOT_PRECEDENCE'"
-  c_p="$c_p                     ) DEFAULT 0 NOT NULL,"
-  c_p="$c_p   comment           char(64) binary DEFAULT '' NOT NULL,"
+  c_p="$c_p                     ) DEFAULT '' NOT NULL,"
+  c_p="$c_p   comment           char(64) collate utf8_bin DEFAULT '' NOT NULL,"
   c_p="$c_p   PRIMARY KEY (db,name,type)"
-  c_p="$c_p ) comment='Stored Procedures';"
+  c_p="$c_p ) engine=MyISAM"
+  c_p="$c_p character set utf8"
+  c_p="$c_p comment='Stored Procedures';"
 fi
 
 cat << END_OF_DATA
Thread
bk commit into 5.0 tree (pem:1.1900) BUG#11365pem11 Jul