Below is the list of changes that have just been committed into a local
5.2 repository of emurphy. When emurphy 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.2211 06/06/23 09:49:23 elliot@scared.(none) +13 -0
Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into mysql.com:/home/emurphy/src/bk-clean/mysql-5.2
sql/share/errmsg.txt
1.91 06/06/23 09:49:17 elliot@scared.(none) +0 -0
Auto merged
sql/sql_yacc.yy
1.467 06/06/23 09:49:16 elliot@scared.(none) +0 -0
Auto merged
sql/item.h
1.199 06/06/23 09:49:16 elliot@scared.(none) +0 -0
Auto merged
sql/item.cc
1.178 06/06/23 09:49:16 elliot@scared.(none) +0 -0
Auto merged
sql/handler.cc
1.223 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
sql/ha_innodb.cc
1.265 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
mysql-test/t/trigger-grant.test
1.12 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
mysql-test/t/innodb.test
1.136 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
mysql-test/r/trigger-grant.result
1.10 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
mysql-test/r/innodb.result
1.170 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
mysql-test/mysql-test-run.pl
1.124 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
mysql-test/lib/mtr_process.pl
1.35 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
configure.in
1.347 06/06/23 09:49:15 elliot@scared.(none) +0 -0
Auto merged
# 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: elliot
# Host: scared.(none)
# Root: /home/emurphy/src/bk-clean/mysql-5.2/RESYNC
--- 1.346/configure.in 2006-06-10 03:37:02 -04:00
+++ 1.347/configure.in 2006-06-23 09:49:15 -04:00
@@ -2474,10 +2474,6 @@ AC_SUBST(netware_dir)
AC_SUBST(linked_netware_sources)
AM_CONDITIONAL(HAVE_NETWARE, test "$netware_dir" = "netware")
-# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
-export CC CXX CFLAGS CXXFLAGS LD LDFLAGS AR
-ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'"
-
if test "$with_server" = "yes" -o "$THREAD_SAFE_CLIENT" != "no"
then
AC_DEFINE([THREAD], [1],
@@ -2527,22 +2523,6 @@ AC_SUBST(CC)
AC_SUBST(GXX)
# Set configuration options for make_binary_distribution
-
-CONF_ARGS=
-case $SYSTEM_TYPE in
- *netware*)
- MAKE_BINARY_DISTRIBUTION_OPTIONS=--no-strip
- CONF_ARGS=--host="$MACHINE_TYPE-$SYSTEM_TYPE"
- ;;
- *)
- MAKE_BINARY_DISTRIBUTION_OPTIONS=
- ;;
-esac
-
-for CONF in $other_configures; do
- (cd `dirname $CONF`; ./`basename $CONF` $CONF_ARGS --build=$build_alias)
-done
-
AC_SUBST(MAKE_BINARY_DISTRIBUTION_OPTIONS)
# Output results
@@ -2559,8 +2539,13 @@ AC_CONFIG_FILES(Makefile extra/Makefile
support-files/MacOSX/Makefile mysql-test/Makefile dnl
mysql-test/ndb/Makefile netware/Makefile dnl
include/mysql_version.h plugin/Makefile win/Makefile)
- AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
- AC_OUTPUT
+
+AC_CONFIG_COMMANDS([default], , test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h)
+
+# Ensure that table handlers gets all modifications to CFLAGS/CXXFLAGS
+AC_CONFIG_COMMANDS_POST(ac_configure_args="$ac_configure_args CFLAGS='$CFLAGS' CXXFLAGS='$CXXFLAGS'")
+
+AC_OUTPUT
echo
echo "MySQL has a Web site at http://www.mysql.com/ which carries details on the"
--- 1.222/sql/handler.cc 2006-06-10 03:34:23 -04:00
+++ 1.223/sql/handler.cc 2006-06-23 09:49:15 -04:00
@@ -53,6 +53,8 @@ st_plugin_int *hton2plugin[MAX_HA];
static handlerton *installed_htons[128];
+#define BITMAP_STACKBUF_SIZE (128/8)
+
KEY_CREATE_INFO default_key_create_info= { HA_KEY_ALG_UNDEF, 0, {NullS,0} };
/* static functions defined in this file */
@@ -68,14 +70,14 @@ ulong total_ha_2pc= 0;
/* size of savepoint storage area (see ha_init) */
ulong savepoint_alloc_size= 0;
-struct show_table_alias_st sys_table_aliases[]=
+static const LEX_STRING sys_table_aliases[]=
{
- {"INNOBASE", DB_TYPE_INNODB},
- {"NDB", DB_TYPE_NDBCLUSTER},
- {"BDB", DB_TYPE_BERKELEY_DB},
- {"HEAP", DB_TYPE_HEAP},
- {"MERGE", DB_TYPE_MRG_MYISAM},
- {NullS, DB_TYPE_UNKNOWN}
+ {(char*)STRING_WITH_LEN("INNOBASE")}, {(char*)STRING_WITH_LEN("INNODB")},
+ {(char*)STRING_WITH_LEN("NDB")}, {(char*)STRING_WITH_LEN("NDBCLUSTER")},
+ {(char*)STRING_WITH_LEN("BDB")}, {(char*)STRING_WITH_LEN("BERKELEYDB")},
+ {(char*)STRING_WITH_LEN("HEAP")}, {(char*)STRING_WITH_LEN("MEMORY")},
+ {(char*)STRING_WITH_LEN("MERGE")}, {(char*)STRING_WITH_LEN("MRG_MYISAM")},
+ {NullS, 0}
};
const char *ha_row_type[] = {
@@ -91,15 +93,50 @@ TYPELIB tx_isolation_typelib= {array_ele
static TYPELIB known_extensions= {0,"known_exts", NULL, NULL};
uint known_extensions_id= 0;
-handlerton *ha_resolve_by_name(THD *thd, LEX_STRING *name)
+
+/*
+ Return the default storage engine handlerton for thread
+
+ SYNOPSIS
+ ha_default_handlerton(thd)
+ thd current thread
+
+ RETURN
+ pointer to handlerton
+*/
+
+handlerton *ha_default_handlerton(THD *thd)
+{
+ return (thd->variables.table_type != NULL) ?
+ thd->variables.table_type :
+ (global_system_variables.table_type != NULL ?
+ global_system_variables.table_type : &myisam_hton);
+}
+
+
+/*
+ Return the storage engine handlerton for the supplied name
+
+ SYNOPSIS
+ ha_resolve_by_name(thd, name)
+ thd current thread
+ name name of storage engine
+
+ RETURN
+ pointer to handlerton
+*/
+
+handlerton *ha_resolve_by_name(THD *thd, const LEX_STRING *name)
{
- show_table_alias_st *table_alias;
+ const LEX_STRING *table_alias;
st_plugin_int *plugin;
- if (thd && !my_strnncoll(&my_charset_latin1,
+redo:
+ /* my_strnncoll is a macro and gcc doesn't do early expansion of macro */
+ if (thd && !my_charset_latin1.coll->strnncoll(&my_charset_latin1,
(const uchar *)name->str, name->length,
- (const uchar *)"DEFAULT", 7))
- return ha_resolve_by_legacy_type(thd, DB_TYPE_DEFAULT);
+ (const uchar *)STRING_WITH_LEN("DEFAULT"), 0))
+ return ha_default_handlerton(thd);
if ((plugin= plugin_lock(name, MYSQL_STORAGE_ENGINE_PLUGIN)))
{
@@ -112,13 +149,15 @@ handlerton *ha_resolve_by_name(THD *thd,
/*
We check for the historical aliases.
*/
- for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
+ for (table_alias= sys_table_aliases; table_alias->str; table_alias+= 2)
{
if (!my_strnncoll(&my_charset_latin1,
(const uchar *)name->str, name->length,
- (const uchar *)table_alias->alias,
- strlen(table_alias->alias)))
- return ha_resolve_by_legacy_type(thd, table_alias->type);
+ (const uchar *)table_alias->str, table_alias->length))
+ {
+ name= table_alias + 1;
+ goto redo;
+ }
}
return NULL;
@@ -130,20 +169,20 @@ const char *ha_get_storage_engine(enum l
switch (db_type) {
case DB_TYPE_DEFAULT:
return "DEFAULT";
- case DB_TYPE_UNKNOWN:
- return "UNKNOWN";
default:
if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT &&
installed_htons[db_type])
return hton2plugin[installed_htons[db_type]->slot]->name.str;
- return "*NONE*";
+ /* fall through */
+ case DB_TYPE_UNKNOWN:
+ return "UNKNOWN";
}
}
static handler *create_default(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
- handlerton *hton=ha_resolve_by_legacy_type(current_thd, DB_TYPE_DEFAULT);
+ handlerton *hton= ha_default_handlerton(current_thd);
return (hton && hton->create) ? hton->create(table, mem_root) : NULL;
}
@@ -152,10 +191,7 @@ handlerton *ha_resolve_by_legacy_type(TH
{
switch (db_type) {
case DB_TYPE_DEFAULT:
- return (thd->variables.table_type != NULL) ?
- thd->variables.table_type :
- (global_system_variables.table_type != NULL ?
- global_system_variables.table_type : &myisam_hton);
+ return ha_default_handlerton(thd);
case DB_TYPE_UNKNOWN:
return NULL;
default:
@@ -196,7 +232,7 @@ handlerton *ha_checktype(THD *thd, enum
break;
}
- return ha_resolve_by_legacy_type(thd, DB_TYPE_DEFAULT);
+ return ha_default_handlerton(thd);
} /* ha_checktype */
@@ -3200,35 +3236,133 @@ namespace {
}
}
-template<class RowsEventT> int binlog_log_row(TABLE *table,
- const byte *before_record,
- const byte *after_record)
+/*
+ Write table maps for all (manually or automatically) locked tables
+ to the binary log.
+
+ SYNOPSIS
+ write_locked_table_maps()
+ thd Pointer to THD structure
+
+ DESCRIPTION
+ This function will generate and write table maps for all tables
+ that are locked by the thread 'thd'. Either manually locked
+ (stored in THD::locked_tables) and automatically locked (stored
+ in THD::lock) are considered.
+
+ RETURN VALUE
+ 0 All OK
+ 1 Failed to write all table maps
+
+ SEE ALSO
+ THD::lock
+ THD::locked_tables
+ */
+namespace
{
- if (table->file->is_injective())
- return 0;
- bool error= 0;
+ int write_locked_table_maps(THD *thd)
+ {
+ DBUG_ENTER("write_locked_table_maps");
+ DBUG_PRINT("enter", ("thd=%p, thd->lock=%p, thd->locked_tables=%p, thd->extra_lock",
+ thd, thd->lock, thd->locked_tables, thd->extra_lock));
+
+ if (thd->get_binlog_table_maps() == 0)
+ {
+ MYSQL_LOCK *locks[3];
+ locks[0]= thd->extra_lock;
+ locks[1]= thd->lock;
+ locks[2]= thd->locked_tables;
+ for (uint i= 0 ; i < sizeof(locks)/sizeof(*locks) ; ++i )
+ {
+ MYSQL_LOCK const *const lock= locks[i];
+ if (lock == NULL)
+ continue;
- if (check_table_binlog_row_based(table->in_use, table))
+ TABLE **const end_ptr= lock->table + lock->table_count;
+ for (TABLE **table_ptr= lock->table ;
+ table_ptr != end_ptr ;
+ ++table_ptr)
+ {
+ TABLE *const table= *table_ptr;
+ DBUG_PRINT("info", ("Checking table %s", table->s->table_name));
+ if (table->current_lock == F_WRLCK &&
+ check_table_binlog_row_based(thd, table))
+ {
+ int const has_trans= table->file->has_transactions();
+ int const error= thd->binlog_write_table_map(table, has_trans);
+ /*
+ If an error occurs, it is the responsibility of the caller to
+ roll back the transaction.
+ */
+ if (unlikely(error))
+ DBUG_RETURN(1);
+ }
+ }
+ }
+ }
+ DBUG_RETURN(0);
+ }
+
+ template<class RowsEventT> int
+ binlog_log_row(TABLE* table,
+ const byte *before_record,
+ const byte *after_record)
{
- error=
- RowsEventT::binlog_row_logging_function(table->in_use, table,
- table->file->has_transactions(),
- &table->s->all_set,
- table->s->fields,
- before_record, after_record);
+ if (table->file->ha_table_flags() & HA_HAS_OWN_BINLOGGING)
+ return 0;
+ bool error= 0;
+ THD *const thd= table->in_use;
+
+ if (check_table_binlog_row_based(thd, table))
+ {
+ MY_BITMAP cols;
+ /* Potential buffer on the stack for the bitmap */
+ uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)];
+ uint n_fields= table->s->fields;
+ my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8;
+
+ /*
+ If there are no table maps written to the binary log, this is
+ the first row handled in this statement. In that case, we need
+ to write table maps for all locked tables to the binary log.
+ */
+ if (likely(!(error= bitmap_init(&cols,
+ use_bitbuf ? bitbuf : NULL,
+ (n_fields + 7) & ~7UL,
+ FALSE))))
+ {
+ bitmap_set_all(&cols);
+ if (likely(!(error= write_locked_table_maps(thd))))
+ {
+ error=
+ RowsEventT::binlog_row_logging_function(thd, table,
+ table->file->
+ has_transactions(),
+ &cols, table->s->fields,
+ before_record,
+ after_record);
+ }
+ if (!use_bitbuf)
+ bitmap_free(&cols);
+ }
+ }
+ return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
}
- return error ? HA_ERR_RBR_LOGGING_FAILED : 0;
-}
+ /*
+ Instantiate the versions we need for the above template function,
+ because we have -fno-implicit-template as compiling option.
+ */
-/*
- Instantiate the versions we need for the above template function, because we
- have -fno-implicit-template as compiling option.
-*/
+ template int
+ binlog_log_row<Write_rows_log_event>(TABLE *, const byte *, const byte *);
-template int binlog_log_row<Write_rows_log_event>(TABLE *, const byte *, const byte *);
-template int binlog_log_row<Delete_rows_log_event>(TABLE *, const byte *, const byte *);
-template int binlog_log_row<Update_rows_log_event>(TABLE *, const byte *, const byte *);
+ template int
+ binlog_log_row<Delete_rows_log_event>(TABLE *, const byte *, const byte *);
+
+ template int
+ binlog_log_row<Update_rows_log_event>(TABLE *, const byte *, const byte *);
+}
#endif /* HAVE_ROW_BASED_REPLICATION */
@@ -3238,41 +3372,6 @@ int handler::ha_external_lock(THD *thd,
int error;
if (unlikely(error= external_lock(thd, lock_type)))
DBUG_RETURN(error);
-#ifdef HAVE_ROW_BASED_REPLICATION
- if (table->file->is_injective())
- DBUG_RETURN(0);
-
- /*
- There is a number of statements that are logged statement-based
- but call external lock. For these, we do not need to generate a
- table map.
-
- TODO: The need for this switch is an indication that the model for
- locking combined with row-based replication needs to be looked
- over. Ideally, no such special handling should be needed.
- */
- switch (thd->lex->sql_command) {
- case SQLCOM_TRUNCATE:
- case SQLCOM_ALTER_TABLE:
- case SQLCOM_OPTIMIZE:
- case SQLCOM_REPAIR:
- DBUG_RETURN(0);
- default:
- break;
- }
-
- /*
- If we are locking a table for writing, we generate a table map.
- For all other kinds of locks, we don't do anything.
- */
- if (lock_type == F_WRLCK && check_table_binlog_row_based(thd, table))
- {
- int const has_trans= table->file->has_transactions();
- error= thd->binlog_write_table_map(table, has_trans);
- if (unlikely(error))
- DBUG_RETURN(error);
- }
-#endif
DBUG_RETURN(0);
}
--- 1.177/sql/item.cc 2006-06-10 03:34:24 -04:00
+++ 1.178/sql/item.cc 2006-06-23 09:49:16 -04:00
@@ -61,7 +61,7 @@ Hybrid_type_traits::val_decimal(Hybrid_t
String *
Hybrid_type_traits::val_str(Hybrid_type *val, String *to, uint8 decimals) const
{
- to->set(val->real, decimals, &my_charset_bin);
+ to->set_real(val->real, decimals, &my_charset_bin);
return to;
}
@@ -202,7 +202,7 @@ String *Item::val_string_from_real(Strin
double nr= val_real();
if (null_value)
return 0; /* purecov: inspected */
- str->set(nr,decimals, &my_charset_bin);
+ str->set_real(nr,decimals, &my_charset_bin);
return str;
}
@@ -212,10 +212,7 @@ String *Item::val_string_from_int(String
longlong nr= val_int();
if (null_value)
return 0;
- if (unsigned_flag)
- str->set((ulonglong) nr, &my_charset_bin);
- else
- str->set(nr, &my_charset_bin);
+ str->set_int(nr, unsigned_flag, &my_charset_bin);
return str;
}
@@ -2041,7 +2038,7 @@ String *Item_float::val_str(String *str)
{
// following assert is redundant, because fixed=1 assigned in constructor
DBUG_ASSERT(fixed == 1);
- str->set(value,decimals,&my_charset_bin);
+ str->set_real(value,decimals,&my_charset_bin);
return str;
}
@@ -2636,7 +2633,7 @@ String *Item_param::val_str(String* str)
case LONG_DATA_VALUE:
return &str_value_ptr;
case REAL_VALUE:
- str->set(value.real, NOT_FIXED_DEC, &my_charset_bin);
+ str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin);
return str;
case INT_VALUE:
str->set(value.integer, &my_charset_bin);
@@ -2676,7 +2673,7 @@ const String *Item_param::query_val_str(
str->set(value.integer, &my_charset_bin);
break;
case REAL_VALUE:
- str->set(value.real, NOT_FIXED_DEC, &my_charset_bin);
+ str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin);
break;
case DECIMAL_VALUE:
if (my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value,
@@ -4329,7 +4326,7 @@ void Item_float::print(String *str)
}
char buffer[20];
String num(buffer, sizeof(buffer), &my_charset_bin);
- num.set(value, decimals, &my_charset_bin);
+ num.set_real(value, decimals, &my_charset_bin);
str->append(num);
}
@@ -5771,7 +5768,7 @@ longlong Item_cache_real::val_int()
String* Item_cache_real::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
- str->set(value, decimals, default_charset());
+ str->set_real(value, decimals, default_charset());
return str;
}
--- 1.198/sql/item.h 2006-06-10 03:34:24 -04:00
+++ 1.199/sql/item.h 2006-06-23 09:49:16 -04:00
@@ -857,6 +857,14 @@ public:
{
return 0;
}
+ /*
+ result_as_longlong() must return TRUE for Items representing DATE/TIME
+ functions and DATE/TIME table fields.
+ Those Items have result_type()==STRING_RESULT (and not INT_RESULT), but
+ their values should be compared as integers (because the integer
+ representation is more precise than the string one).
+ */
+ virtual bool result_as_longlong() { return FALSE; }
};
@@ -1283,6 +1291,10 @@ public:
bool register_field_in_read_map(byte *arg);
bool check_partition_func_processor(byte *bool_arg) { return 0; }
void cleanup();
+ bool result_as_longlong()
+ {
+ return field->can_be_compared_as_longlong();
+ }
Item_equal *find_item_equal(COND_EQUAL *cond_equal);
Item *equal_fields_propagator(byte *arg);
Item *set_no_const_sub(byte *arg);
@@ -1904,6 +1916,10 @@ public:
bool walk(Item_processor processor, bool walk_subquery, byte *arg)
{ return (*ref)->walk(processor, walk_subquery, arg); }
void print(String *str);
+ bool result_as_longlong()
+ {
+ return (*ref)->result_as_longlong();
+ }
void cleanup();
Item_field *filed_for_view_update()
{ return (*ref)->filed_for_view_update(); }
--- 1.466/sql/sql_yacc.yy 2006-06-10 03:34:25 -04:00
+++ 1.467/sql/sql_yacc.yy 2006-06-23 09:49:16 -04:00
@@ -42,12 +42,6 @@
#include <myisam.h>
#include <myisammrg.h>
-typedef struct p_elem_val
-{
- longlong value;
- bool null_value;
-} part_elem_value;
-
int yylex(void *yylval, void *yythd);
const LEX_STRING null_lex_str={0,0};
@@ -2064,16 +2058,19 @@ sp_cursor_stmt:
{
Lex->sphead->reset_lex(YYTHD);
- /* We use statement here just be able to get a better
- error message. Using 'select' works too, but will then
- result in a generic "syntax error" if a non-select
- statement is given. */
+ /*
+ We use statement here just be able to get a better
+ error message. Using 'select' works too, but will then
+ result in a generic "syntax error" if a non-select
+ statement is given.
+ */
}
statement
{
LEX *lex= Lex;
- if (lex->sql_command != SQLCOM_SELECT)
+ if (lex->sql_command != SQLCOM_SELECT &&
+ !(sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND))
{
my_message(ER_SP_BAD_CURSOR_QUERY, ER(ER_SP_BAD_CURSOR_QUERY),
MYF(0));
@@ -3553,7 +3550,7 @@ opt_part_values:
;
part_func_max:
- MAX_VALUE_SYM
+ max_value_sym
{
LEX *lex= Lex;
if (lex->part_info->defined_max_value)
@@ -3562,6 +3559,7 @@ part_func_max:
YYABORT;
}
lex->part_info->defined_max_value= TRUE;
+ lex->part_info->curr_part_elem->max_value= TRUE;
lex->part_info->curr_part_elem->range_value= LONGLONG_MAX;
}
| part_range_func
@@ -3579,10 +3577,18 @@ part_func_max:
}
;
+max_value_sym:
+ MAX_VALUE_SYM
+ | '(' MAX_VALUE_SYM ')'
+ ;
+
part_range_func:
'(' part_bit_expr ')'
{
- Lex->part_info->curr_part_elem->range_value= $2->value;
+ partition_info *part_info= Lex->part_info;
+ if (!($2->unsigned_flag))
+ part_info->curr_part_elem->signed_flag= TRUE;
+ part_info->curr_part_elem->range_value= $2->value;
}
;
@@ -3595,9 +3601,12 @@ part_list_item:
part_bit_expr
{
part_elem_value *value_ptr= $1;
+ partition_info *part_info= Lex->part_info;
+ if (!value_ptr->unsigned_flag)
+ part_info->curr_part_elem->signed_flag= TRUE;
if (!value_ptr->null_value &&
- Lex->part_info->curr_part_elem->
- list_val_list.push_back((longlong*) &value_ptr->value))
+ part_info->curr_part_elem->
+ list_val_list.push_back(value_ptr))
{
mem_alloc_error(sizeof(part_elem_value));
YYABORT;
@@ -3638,6 +3647,10 @@ part_bit_expr:
}
thd->where= save_where;
value_ptr->value= part_expr->val_int();
+ value_ptr->unsigned_flag= TRUE;
+ if (!part_expr->unsigned_flag &&
+ value_ptr->value < 0)
+ value_ptr->unsigned_flag= FALSE;
if ((value_ptr->null_value= part_expr->null_value))
{
if (Lex->part_info->curr_part_elem->has_null_value)
@@ -8052,16 +8065,14 @@ show_param:
DATABASES wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_DATABASES;
+ lex->sql_command= SQLCOM_SHOW_DATABASES;
if (prepare_schema_table(YYTHD, lex, 0, SCH_SCHEMATA))
YYABORT;
}
| opt_full TABLES opt_db wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_TABLES;
+ lex->sql_command= SQLCOM_SHOW_TABLES;
lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLE_NAMES))
YYABORT;
@@ -8069,8 +8080,7 @@ show_param:
| opt_full TRIGGERS_SYM opt_db wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_TRIGGERS;
+ lex->sql_command= SQLCOM_SHOW_TRIGGERS;
lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TRIGGERS))
YYABORT;
@@ -8078,8 +8088,7 @@ show_param:
| EVENTS_SYM opt_db wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_EVENTS;
+ lex->sql_command= SQLCOM_SHOW_EVENTS;
lex->select_lex.db= $2;
if (prepare_schema_table(YYTHD, lex, 0, SCH_EVENTS))
YYABORT;
@@ -8096,8 +8105,7 @@ show_param:
| TABLE_SYM STATUS_SYM opt_db wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_TABLE_STATUS;
+ lex->sql_command= SQLCOM_SHOW_TABLE_STATUS;
lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_TABLES))
YYABORT;
@@ -8105,8 +8113,7 @@ show_param:
| OPEN_SYM TABLES opt_db wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_OPEN_TABLES;
+ lex->sql_command= SQLCOM_SHOW_OPEN_TABLES;
lex->select_lex.db= $3;
if (prepare_schema_table(YYTHD, lex, 0, SCH_OPEN_TABLES))
YYABORT;
@@ -8115,16 +8122,14 @@ show_param:
{
LEX *lex= Lex;
WARN_DEPRECATED(yythd, "5.2", "SHOW PLUGIN", "'SHOW PLUGINS'");
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_PLUGINS;
+ lex->sql_command= SQLCOM_SHOW_PLUGINS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS))
YYABORT;
}
| PLUGINS_SYM
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_PLUGINS;
+ lex->sql_command= SQLCOM_SHOW_PLUGINS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PLUGINS))
YYABORT;
}
@@ -8137,8 +8142,7 @@ show_param:
| opt_full COLUMNS from_or_in table_ident opt_db wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_FIELDS;
+ lex->sql_command= SQLCOM_SHOW_FIELDS;
if ($5)
$4->change_db($5);
if (prepare_schema_table(YYTHD, lex, $4, SCH_COLUMNS))
@@ -8170,8 +8174,7 @@ show_param:
| keys_or_index from_or_in table_ident opt_db where_clause
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_KEYS;
+ lex->sql_command= SQLCOM_SHOW_KEYS;
if ($4)
$3->change_db($4);
if (prepare_schema_table(YYTHD, lex, $3, SCH_STATISTICS))
@@ -8192,7 +8195,6 @@ show_param:
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
- lex->orig_sql_command= SQLCOM_SHOW_AUTHORS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_ENGINES))
YYABORT;
}
@@ -8222,8 +8224,7 @@ show_param:
| opt_var_type STATUS_SYM wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_STATUS;
+ lex->sql_command= SQLCOM_SHOW_STATUS;
lex->option_type= $1;
if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
YYABORT;
@@ -8257,8 +8258,7 @@ show_param:
| opt_var_type VARIABLES wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_VARIABLES;
+ lex->sql_command= SQLCOM_SHOW_VARIABLES;
lex->option_type= $1;
if (prepare_schema_table(YYTHD, lex, 0, SCH_VARIABLES))
YYABORT;
@@ -8266,16 +8266,14 @@ show_param:
| charset wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_CHARSETS;
+ lex->sql_command= SQLCOM_SHOW_CHARSETS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_CHARSETS))
YYABORT;
}
| COLLATION_SYM wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_COLLATIONS;
+ lex->sql_command= SQLCOM_SHOW_COLLATIONS;
if (prepare_schema_table(YYTHD, lex, 0, SCH_COLLATIONS))
YYABORT;
}
@@ -8381,8 +8379,7 @@ show_param:
| PROCEDURE STATUS_SYM wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_STATUS_PROC;
+ lex->sql_command= SQLCOM_SHOW_STATUS_PROC;
if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ))
YYABORT;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
@@ -8391,8 +8388,7 @@ show_param:
| FUNCTION_SYM STATUS_SYM wild_and_where
{
LEX *lex= Lex;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_STATUS_FUNC;
+ lex->sql_command= SQLCOM_SHOW_STATUS_FUNC;
if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ))
YYABORT;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
@@ -8487,8 +8483,7 @@ describe:
lex->lock_option= TL_READ;
mysql_init_select(lex);
lex->current_select->parsing_place= SELECT_LIST;
- lex->sql_command= SQLCOM_SELECT;
- lex->orig_sql_command= SQLCOM_SHOW_FIELDS;
+ lex->sql_command= SQLCOM_SHOW_FIELDS;
lex->select_lex.db= 0;
lex->verbose= 0;
if (prepare_schema_table(YYTHD, lex, $2, SCH_COLUMNS))
@@ -10625,6 +10620,8 @@ union_list:
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
+ /* This counter shouldn't be incremented for UNION parts */
+ Lex->nest_level--;
if (mysql_new_select(lex, 0))
YYABORT;
mysql_init_select(lex);
--- 1.90/sql/share/errmsg.txt 2006-06-10 03:34:25 -04:00
+++ 1.91/sql/share/errmsg.txt 2006-06-23 09:49:17 -04:00
@@ -5810,6 +5810,9 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT
eng "The NDB cluster engine does not support changing the binlog format on the fly yet"
ER_PARTITION_NO_TEMPORARY
eng "Cannot create temporary table with partitions"
+ER_PARTITION_CONST_DOMAIN_ERROR
+ eng "Partition constant is out of partition function domain"
ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
eng "This partition function is not allowed"
@@ -5830,5 +5833,9 @@ ER_EVENT_MODIFY_QUEUE_ERROR
ER_EVENT_SET_VAR_ERROR
eng "Error during starting/stopping of the scheduler. Error code %u"
ER_PARTITION_MERGE_ERROR
- eng "MyISAM Merge handler cannot be used in partitioned tables"
+ eng "%s handler cannot be used in partitioned tables"
+ER_CANT_ACTIVATE_LOG
+ eng "Cannot activate '%-.64s' log."
+ER_RBR_NOT_AVAILABLE
+ eng "The server was not built with row-based replication"
--- 1.9/mysql-test/r/trigger-grant.result 2006-06-10 03:34:22 -04:00
+++ 1.10/mysql-test/r/trigger-grant.result 2006-06-23 09:49:15 -04:00
@@ -51,8 +51,8 @@ GRANT TRIGGER ON mysqltest_db1.t1 TO mys
---> connection: wl2818_definer_con
INSERT INTO t1 VALUES(0);
DROP TRIGGER trg1;
-DELETE FROM t1;
-DELETE FROM t2;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
---> connection: default
REVOKE SUPER ON *.* FROM mysqltest_dfn@localhost;
--- 1.11/mysql-test/t/trigger-grant.test 2006-06-10 03:34:23 -04:00
+++ 1.12/mysql-test/t/trigger-grant.test 2006-06-23 09:49:15 -04:00
@@ -151,8 +151,8 @@ INSERT INTO t1 VALUES(0);
# Cleanup for further tests.
DROP TRIGGER trg1;
-DELETE FROM t1;
-DELETE FROM t2;
+TRUNCATE TABLE t1;
+TRUNCATE TABLE t2;
--disconnect wl2818_definer_con
--- 1.34/mysql-test/lib/mtr_process.pl 2006-06-10 03:23:03 -04:00
+++ 1.35/mysql-test/lib/mtr_process.pl 2006-06-23 09:49:15 -04:00
@@ -880,19 +880,28 @@ sub mtr_kill_processes ($) {
sub mtr_kill_process ($$$$) {
my $pid= shift;
my $signal= shift;
- my $retries= shift;
+ my $total_retries= shift;
my $timeout= shift;
- while (1)
+ for (my $cur_attempt= 1; $cur_attempt <= $total_retries; ++$cur_attempt)
{
+ mtr_debug("Sending $signal to $pid...");
+
kill($signal, $pid);
- last unless kill (0, $pid) and $retries--;
+ unless (kill (0, $pid))
+ {
+ mtr_debug("Process $pid died.");
+ return;
+ }
- mtr_debug("Sleep $timeout second waiting for processes to die");
+ mtr_debug("Sleeping $timeout second(s) waiting for processes to die...");
sleep($timeout);
}
+
+ mtr_debug("Process $pid is still alive after $total_retries " .
+ "of sending signal $signal.");
}
##############################################################################
--- 1.123/mysql-test/mysql-test-run.pl 2006-06-10 03:23:03 -04:00
+++ 1.124/mysql-test/mysql-test-run.pl 2006-06-23 09:49:15 -04:00
@@ -290,7 +290,7 @@ our $opt_user_test;
our $opt_valgrind= 0;
our $opt_valgrind_mysqld= 0;
our $opt_valgrind_mysqltest= 0;
-our $opt_valgrind_all= 0;
+our $default_valgrind_options= "-v --show-reachable=yes";
our $opt_valgrind_options;
our $opt_valgrind_path;
@@ -629,10 +629,9 @@ sub command_line_setup () {
# Coverage, profiling etc
'gcov' => \$opt_gcov,
'gprof' => \$opt_gprof,
- 'valgrind' => \$opt_valgrind,
+ 'valgrind|valgrind-all' => \$opt_valgrind,
'valgrind-mysqltest' => \$opt_valgrind_mysqltest,
'valgrind-mysqld' => \$opt_valgrind_mysqld,
- 'valgrind-all' => \$opt_valgrind_all,
'valgrind-options=s' => \$opt_valgrind_options,
'valgrind-path=s' => \$opt_valgrind_path,
@@ -816,20 +815,32 @@ sub command_line_setup () {
}
}
- # Turn on valgrinding of all executables if "valgrind" or "valgrind-all"
- if ( $opt_valgrind or $opt_valgrind_all )
+ # Check valgrind arguments
+ if ( $opt_valgrind or $opt_valgrind_path or defined $opt_valgrind_options)
{
mtr_report("Turning on valgrind for all executables");
$opt_valgrind= 1;
$opt_valgrind_mysqld= 1;
$opt_valgrind_mysqltest= 1;
}
- elsif ( $opt_valgrind_mysqld or $opt_valgrind_mysqltest )
+ elsif ( $opt_valgrind_mysqld )
{
- # If test's are run for a specific executable, turn on
- # verbose and show-reachable
+ mtr_report("Turning on valgrind for mysqld(s) only");
+ $opt_valgrind= 1;
+ }
+ elsif ( $opt_valgrind_mysqltest )
+ {
+ mtr_report("Turning on valgrind for mysqltest only");
$opt_valgrind= 1;
- $opt_valgrind_all= 1;
+ }
+
+ if ( $opt_valgrind )
+ {
+ # Set valgrind_options to default unless already defined
+ $opt_valgrind_options=$default_valgrind_options
+ unless defined $opt_valgrind_options;
+
+ mtr_report("Running valgrind with options \"$opt_valgrind_options\"");
}
if ( ! $opt_testcase_timeout )
@@ -3109,22 +3120,58 @@ sub im_stop($) {
# Try graceful shutdown.
+ mtr_debug("IM-main pid: $instance_manager->{'pid'}");
+ mtr_debug("Stopping IM-main...");
+
mtr_kill_process($instance_manager->{'pid'}, 'TERM', 10, 1);
+ # If necessary, wait for angel process to die.
+
+ if (defined $instance_manager->{'angel_pid'})
+ {
+ mtr_debug("IM-angel pid: $instance_manager->{'angel_pid'}");
+ mtr_debug("Waiting for IM-angel to die...");
+
+ my $total_attempts= 10;
+
+ for (my $cur_attempt=1; $cur_attempt <= $total_attempts; ++$cur_attempt)
+ {
+ unless (kill (0, $instance_manager->{'angel_pid'}))
+ {
+ mtr_debug("IM-angel died.");
+ last;
+ }
+
+ sleep(1);
+ }
+ }
+
# Check that all processes died.
my $clean_shutdown= 0;
while (1)
{
- last if kill (0, $instance_manager->{'pid'});
+ if (kill (0, $instance_manager->{'pid'}))
+ {
+ mtr_debug("IM-main is still alive.");
+ last;
+ }
- last if (defined $instance_manager->{'angel_pid'}) &&
- kill (0, $instance_manager->{'angel_pid'});
+ if (defined $instance_manager->{'angel_pid'} &&
+ kill (0, $instance_manager->{'angel_pid'}))
+ {
+ mtr_debug("IM-angel is still alive.");
+ last;
+ }
foreach my $pid (@mysqld_pids)
{
- last if kill (0, $pid);
+ if (kill (0, $pid))
+ {
+ mtr_debug("Guarded mysqld ($pid) is still alive.");
+ last;
+ }
}
$clean_shutdown= 1;
@@ -3135,15 +3182,21 @@ sub im_stop($) {
unless ($clean_shutdown)
{
- mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1)
- if defined $instance_manager->{'angel_pid'};
+
+ if (defined $instance_manager->{'angel_pid'})
+ {
+ mtr_debug("Killing IM-angel...");
+ mtr_kill_process($instance_manager->{'angel_pid'}, 'KILL', 10, 1)
+ }
+ mtr_debug("Killing IM-main...");
mtr_kill_process($instance_manager->{'pid'}, 'KILL', 10, 1);
# Shutdown managed mysqld-processes. Some of them may be nonguarded, so IM
# will not stop them on shutdown. So, we should firstly try to end them
# legally.
+ mtr_debug("Killing guarded mysqld(s)...");
mtr_kill_processes(\@mysqld_pids);
# Complain in error log so that a warning will be shown.
@@ -3694,17 +3747,8 @@ sub valgrind_arguments {
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
- if ( $opt_valgrind_all )
- {
- mtr_add_arg($args, "-v");
- mtr_add_arg($args, "--show-reachable=yes");
- }
-
- if ( $opt_valgrind_options )
- {
- mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options));
- }
-
+ # Add valgrind options, can be overriden by user
+ mtr_add_arg($args, '%s', $_) for (split(' ', $opt_valgrind_options));
mtr_add_arg($args, $$exe);
@@ -3816,12 +3860,11 @@ Options for coverage, profiling etc
gcov FIXME
gprof FIXME
valgrind Run the "mysqltest" and "mysqld" executables using
- valgrind
- valgrind-all Same as "valgrind" but will also add "verbose" and
- "--show-reachable" flags to valgrind
+ valgrind with options($default_valgrind_options)
+ valgrind-all Synonym for --valgrind
valgrind-mysqltest Run the "mysqltest" executable with valgrind
valgrind-mysqld Run the "mysqld" executable with valgrind
- valgrind-options=ARGS Extra options to give valgrind
+ valgrind-options=ARGS Options to give valgrind, replaces default options
valgrind-path=[EXE] Path to the valgrind executable
Misc options
--- 1.169/mysql-test/r/innodb.result 2006-06-10 03:23:03 -04:00
+++ 1.170/mysql-test/r/innodb.result 2006-06-23 09:49:15 -04:00
@@ -1378,9 +1378,9 @@ insert into `t2`values ( 1 ) ;
create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
insert into `t3`values ( 1 ) ;
delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
drop table t3,t2,t1;
@@ -1392,7 +1392,7 @@ foreign key(pid) references t1(id) on de
insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
(8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
delete from t1 where id=0;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
delete from t1 where id=15;
delete from t1 where id=0;
drop table t1;
@@ -2633,18 +2633,18 @@ v INT,
CONSTRAINT c1 FOREIGN KEY (v) REFERENCES t1(id)
) ENGINE=InnoDB;
INSERT INTO t2 VALUES(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
INSERT INTO t1 VALUES(1);
INSERT INTO t2 VALUES(1);
DELETE FROM t1 WHERE id = 1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE t1;
SET FOREIGN_KEY_CHECKS=1;
INSERT INTO t2 VALUES(3);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c1` FOREIGN KEY (`v`) REFERENCES `t1` (`id`))
DROP TABLE t2;
create table t1(a int not null) engine=innodb DEFAULT CHARSET=latin1;
insert into t1 values (1),(2);
@@ -2922,23 +2922,23 @@ create table t4(a int primary key,constr
insert into t1 values(1);
insert into t3 values(1);
insert into t2 values(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
insert into t4 values(2);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
insert into t2 values(1);
insert into t4 values(1);
update t1 set a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t2 set a=2;
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
update t3 set a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
update t4 set a=2;
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`a`))
truncate t3;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t4`, CONSTRAINT `t4_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t3` (`a`))
truncate t2;
truncate t4;
truncate t1;
@@ -2993,7 +2993,7 @@ create table t1 (a int primary key,s1 va
create table t2 (s1 binary(2) not null, constraint c foreign key(s1) references t1(s1) on update cascade) engine=innodb;
insert into t1 values(1,0x4100),(2,0x41),(3,0x4120),(4,0x42);
insert into t2 values(0x42);
-ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
insert into t2 values(0x41);
select hex(s1) from t2;
hex(s1)
@@ -3003,11 +3003,11 @@ select hex(s1) from t2;
hex(s1)
4100
update t1 set s1=0x12 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x12345678 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x123457 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
update t1 set s1=0x1220 where a=1;
select hex(s1) from t2;
hex(s1)
@@ -3021,11 +3021,11 @@ select hex(s1) from t2;
hex(s1)
4200
delete from t1 where a=1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a=2;
update t2 set s1=0x4120;
delete from t1;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
delete from t1 where a!=3;
select a,hex(s1) from t1;
a hex(s1)
@@ -3051,7 +3051,7 @@ hex(s1)
12
delete from t1 where a=1;
delete from t1 where a=2;
-ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test/t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `c` FOREIGN KEY (`s1`) REFERENCES `t1` (`s1`) ON UPDATE CASCADE)
select a,hex(s1) from t1;
a hex(s1)
2 12
--- 1.135/mysql-test/t/innodb.test 2006-06-10 03:34:23 -04:00
+++ 1.136/mysql-test/t/innodb.test 2006-06-23 09:49:15 -04:00
@@ -2510,3 +2510,16 @@ BEGIN;
INSERT INTO t1 VALUES (1);
OPTIMIZE TABLE t1;
DROP TABLE t1;
+
+#######################################################################
+# #
+# Please, DO NOT TOUCH this file as well as the innodb.result file. #
+# These files are to be modified ONLY BY INNOBASE guys. #
+# #
+# Use innodb_mysql.[test|result] files instead. #
+# #
+# If nevertheless you need to make some changes here, please, forward #
+# your commit message To: dev@stripped Cc: dev-innodb@stripped #
+# (otherwise your changes may be erased). #
+# #
+#######################################################################
--- 1.264/sql/ha_innodb.cc 2006-06-10 03:34:23 -04:00
+++ 1.265/sql/ha_innodb.cc 2006-06-23 09:49:15 -04:00
@@ -135,6 +135,7 @@ extern "C" {
#include "../storage/innobase/include/fil0fil.h"
#include "../storage/innobase/include/trx0xa.h"
#include "../storage/innobase/include/thr0loc.h"
+#include "../storage/innobase/include/ha_prototypes.h"
}
#define HA_INNOBASE_ROWS_IN_TABLE 10000 /* to get optimization right */
@@ -668,6 +669,61 @@ innobase_get_cset_width(
}
/**********************************************************************
+Converts an identifier to a table name.
+
+NOTE that the exact prototype of this function has to be in
+/innobase/dict/dict0dict.c! */
+extern "C"
+void
+innobase_convert_from_table_id(
+/*===========================*/
+ char* to, /* out: converted identifier */
+ const char* from, /* in: identifier to convert */
+ ulint len) /* in: length of 'to', in bytes */
+{
+ uint errors;
+
+ strconvert(current_thd->charset(), from,
+ &my_charset_filename, to, len, &errors);
+}
+
+/**********************************************************************
+Converts an identifier to UTF-8.
+
+NOTE that the exact prototype of this function has to be in
+/innobase/dict/dict0dict.c! */
+extern "C"
+void
+innobase_convert_from_id(
+/*=====================*/
+ char* to, /* out: converted identifier */
+ const char* from, /* in: identifier to convert */
+ ulint len) /* in: length of 'to', in bytes */
+{
+ uint errors;
+
+ strconvert(current_thd->charset(), from,
+ system_charset_info, to, len, &errors);
+}
+
+/**********************************************************************
+Removes the filename encoding of a table or database name.
+
+NOTE that the exact prototype of this function has to be in
+/innobase/dict/dict0dict.c! */
+extern "C"
+void
+innobase_convert_from_filename(
+/*===========================*/
+ char* s) /* in: identifier; out: decoded identifier */
+{
+ uint errors;
+
+ strconvert(&my_charset_filename, s,
+ system_charset_info, s, strlen(s), &errors);
+}
+
+/**********************************************************************
Compares NUL-terminated UTF-8 strings case insensitively.
NOTE that the exact prototype of this function has to be in
@@ -697,6 +753,21 @@ innobase_casedn_str(
my_casedn_str(system_charset_info, a);
}
+/**************************************************************************
+Determines the connection character set.
+
+NOTE that the exact prototype of this function has to be in
+/innobase/dict/dict0dict.c! */
+extern "C"
+struct charset_info_st*
+innobase_get_charset(
+/*=================*/
+ /* out: connection character set */
+ void* mysql_thd) /* in: MySQL thread handle */
+{
+ return(((THD*) mysql_thd)->charset());
+}
+
/*************************************************************************
Creates a temporary file. */
extern "C"
@@ -743,6 +814,25 @@ innobase_mysql_tmpfile(void)
}
/*************************************************************************
+Wrapper around MySQL's copy_and_convert function, see it for
+documentation. */
+extern "C"
+ulint
+innobase_convert_string(
+/*====================*/
+ void* to,
+ ulint to_length,
+ CHARSET_INFO* to_cs,
+ const void* from,
+ ulint from_length,
+ CHARSET_INFO* from_cs,
+ uint* errors)
+{
+ return(copy_and_convert((char*)to, to_length, to_cs,
+ (const char*)from, from_length, from_cs, errors));
+}
+
+/*************************************************************************
Gets the InnoDB transaction handle for a MySQL handler object, creates
an InnoDB transaction struct if the corresponding MySQL thread struct still
lacks one. */
@@ -1076,23 +1166,69 @@ innobase_invalidate_query_cache(
}
/*********************************************************************
-Get the quote character to be used in SQL identifiers.
+Display an SQL identifier.
This definition must match the one in innobase/ut/ut0ut.c! */
extern "C"
-int
-mysql_get_identifier_quote_char(
-/*============================*/
- /* out: quote character to be
- used in SQL identifiers; EOF if none */
+void
+innobase_print_identifier(
+/*======================*/
+ FILE* f, /* in: output stream */
trx_t* trx, /* in: transaction */
+ ibool table_id,/* in: TRUE=decode table name */
const char* name, /* in: name to print */
ulint namelen)/* in: length of name */
{
+ const char* s = name;
+ char* qname = NULL;
+ int q;
+
+ if (table_id) {
+ /* Decode the table name. The filename_to_tablename()
+ function expects a NUL-terminated string. The input and
+ output strings buffers must not be shared. The function
+ only produces more output when the name contains other
+ characters than [0-9A-Z_a-z]. */
+ char* temp_name = my_malloc(namelen + 1, MYF(MY_WME));
+ uint qnamelen = namelen
+ + (1 + sizeof srv_mysql50_table_name_prefix);
+
+ if (temp_name) {
+ qname = my_malloc(qnamelen, MYF(MY_WME));
+ if (qname) {
+ memcpy(temp_name, name, namelen);
+ temp_name[namelen] = 0;
+ s = qname;
+ namelen = filename_to_tablename(temp_name,
+ qname, qnamelen);
+ }
+ my_free(temp_name, MYF(0));
+ }
+ }
+
if (!trx || !trx->mysql_thd) {
- return(EOF);
+
+ q = '"';
+ } else {
+ q = get_quote_char_for_identifier((THD*) trx->mysql_thd,
+ s, (int) namelen);
}
- return(get_quote_char_for_identifier((THD*) trx->mysql_thd,
- name, (int) namelen));
+
+ if (q == EOF) {
+ fwrite(s, 1, namelen, f);
+ } else {
+ const char* e = s + namelen;
+ putc(q, f);
+ while (s < e) {
+ int c = *s++;
+ if (c == q) {
+ putc(c, f);
+ }
+ putc(c, f);
+ }
+ putc(q, f);
+ }
+
+ my_free(qname, MYF(MY_ALLOW_ZERO_PTR));
}
/**************************************************************************
@@ -1232,6 +1368,24 @@ innobase_init(void)
ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
+#ifdef UNIV_DEBUG
+ static const char test_filename[] = "-@";
+ char test_tablename[sizeof test_filename
+ + sizeof srv_mysql50_table_name_prefix];
+ if ((sizeof test_tablename) - 1
+ != filename_to_tablename(test_filename, test_tablename,
+ sizeof test_tablename)
+ || strncmp(test_tablename,
+ srv_mysql50_table_name_prefix,
+ sizeof srv_mysql50_table_name_prefix)
+ || strcmp(test_tablename
+ + sizeof srv_mysql50_table_name_prefix,
+ test_filename)) {
+ sql_print_error("tablename encoding has been changed");
+ goto error;
+ }
+#endif /* UNIV_DEBUG */
+
/* Check that values don't overflow on 32-bit systems. */
if (sizeof(ulint) == 4) {
if (innobase_buffer_pool_size > UINT_MAX32) {
@@ -2200,8 +2354,7 @@ ha_innobase::open(
/* Get pointer to a table object in InnoDB dictionary cache */
- ib_table = dict_table_get_and_increment_handle_count(
- norm_name, NULL);
+ ib_table = dict_table_get_and_increment_handle_count(norm_name);
if (NULL == ib_table) {
ut_print_timestamp(stderr);
@@ -4116,6 +4269,9 @@ ha_innobase::index_prev(
mysql_byte* buf) /* in/out: buffer for previous row in MySQL
format */
{
+ statistic_increment(current_thd->status_var.ha_read_prev_count,
+ &LOCK_status);
+
return(general_fetch(buf, ROW_SEL_PREV, 0));
}
@@ -4652,7 +4808,7 @@ ha_innobase::create(
/* Get the transaction associated with the current thd, or create one
if not yet created */
- parent_trx = check_trx_exists(current_thd);
+ parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
@@ -4748,20 +4904,9 @@ ha_innobase::create(
}
}
- if (current_thd->query != NULL) {
- LEX_STRING q;
-
- if (thd->convert_string(&q, system_charset_info,
- current_thd->query,
- current_thd->query_length,
- current_thd->charset())) {
- error = HA_ERR_OUT_OF_MEM;
-
- goto cleanup;
- }
-
+ if (thd->query != NULL) {
error = row_table_add_foreign_constraints(trx,
- q.str, norm_name,
+ thd->query, norm_name,
create_info->options & HA_LEX_CREATE_TMP_TABLE);
error = convert_error_code_to_mysql(error, NULL);
@@ -4781,7 +4926,7 @@ ha_innobase::create(
log_buffer_flush_to_disk();
- innobase_table = dict_table_get(norm_name, NULL);
+ innobase_table = dict_table_get(norm_name);
DBUG_ASSERT(innobase_table != 0);
@@ -4917,7 +5062,7 @@ ha_innobase::delete_table(
/* Get the transaction associated with the current thd, or create one
if not yet created */
- parent_trx = check_trx_exists(current_thd);
+ parent_trx = check_trx_exists(thd);
/* In case MySQL calls this in the middle of a SELECT query, release
possible adaptive hash latch to avoid deadlocks of threads */
| Thread |
|---|
| • bk commit into 5.2 tree (elliot:1.2211) | Elliot Murphy | 23 Jun |