From 09e094850b0372677b4af6aa085af34b5a40e0f6 Mon Sep 17 00:00:00 2001 From: "tsmith/tim@siva.hindu.god" <> Date: Fri, 20 Oct 2006 13:44:49 -0600 Subject: [PATCH] Applied InnoDB snapshot 5.1-ss927 Fixes: - Bug #23368: crash during insert, table has foreign key pointing into other schema,permission --- storage/innobase/dict/dict0dict.c | 12 +----------- storage/innobase/include/ut0ut.h | 10 ++++++++-- storage/innobase/ut/ut0ut.c | 12 +++++++++--- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c index d74d5036b1a..7c2fc18accd 100644 --- a/storage/innobase/dict/dict0dict.c +++ b/storage/innobase/dict/dict0dict.c @@ -4146,18 +4146,8 @@ dict_print_info_on_foreign_key_in_create_format( dict_remove_db_name( foreign->referenced_table_name)); } else { - /* Look for the '/' in the table name */ - - i = 0; - while (foreign->referenced_table_name[i] != '/') { - i++; - } - - ut_print_namel(file, trx, TRUE, - foreign->referenced_table_name, i); - putc('.', file); ut_print_name(file, trx, TRUE, - foreign->referenced_table_name + i + 1); + foreign->referenced_table_name); } putc(' ', file); diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 1eafa680d8d..b4e9fa91491 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -218,7 +218,10 @@ ut_print_filename( struct trx_struct; /************************************************************************** -Outputs a NUL-terminated string, quoted as an SQL identifier. */ +Outputs a fixed-length string, quoted as an SQL identifier. +If the string contains a slash '/', the string will be +output as two identifiers separated by a period (.), +as in SQL database_name.identifier. */ void ut_print_name( @@ -230,7 +233,10 @@ ut_print_name( const char* name); /* in: name to print */ /************************************************************************** -Outputs a fixed-length string, quoted as an SQL identifier. */ +Outputs a fixed-length string, quoted as an SQL identifier. +If the string contains a slash '/', the string will be +output as two identifiers separated by a period (.), +as in SQL database_name.identifier. */ void ut_print_namel( diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c index 10641b88a17..d805cc3b4b2 100644 --- a/storage/innobase/ut/ut0ut.c +++ b/storage/innobase/ut/ut0ut.c @@ -394,7 +394,10 @@ done: } /************************************************************************** -Outputs a NUL-terminated string, quoted as an SQL identifier. */ +Outputs a fixed-length string, quoted as an SQL identifier. +If the string contains a slash '/', the string will be +output as two identifiers separated by a period (.), +as in SQL database_name.identifier. */ void ut_print_name( @@ -409,7 +412,10 @@ ut_print_name( } /************************************************************************** -Outputs a fixed-length string, quoted as an SQL identifier. */ +Outputs a fixed-length string, quoted as an SQL identifier. +If the string contains a slash '/', the string will be +output as two identifiers separated by a period (.), +as in SQL database_name.identifier. */ void ut_print_namel( @@ -424,7 +430,7 @@ ut_print_namel( #ifdef UNIV_HOTBACKUP fwrite(name, 1, namelen, f); #else - char* slash = strchr(name, '/'); + char* slash = memchr(name, '/', namelen); if (UNIV_LIKELY_NULL(slash)) { /* Print the database name and table name separately. */