summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-01-05 16:03:58 +0200
committerMichael Widenius <monty@askmonty.org>2011-01-05 16:03:58 +0200
commit215043b7c2ace7ce05dcf6c685c87a293ccf1cd7 (patch)
tree679d57ddbf9713b7129872db144ff408b0215b31 /sql
parent31a78529bc5c4431865eba06762e6cc66359f759 (diff)
parent6b03fbf9fcacc74cb2999ba7715d22d754f356c7 (diff)
downloadmariadb-git-215043b7c2ace7ce05dcf6c685c87a293ccf1cd7.tar.gz
Merge with 5.1
Diffstat (limited to 'sql')
-rw-r--r--sql/item.h13
-rw-r--r--sql/item_func.cc15
-rw-r--r--sql/item_func.h1
-rw-r--r--sql/sql_parse.cc11
-rw-r--r--sql/sql_select.cc6
-rw-r--r--sql/sql_table.cc10
6 files changed, 50 insertions, 6 deletions
diff --git a/sql/item.h b/sql/item.h
index dcfe1b58122..3f732cf126e 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -574,10 +574,17 @@ public:
Field *make_string_field(TABLE *table);
virtual bool fix_fields(THD *, Item **);
/*
- should be used in case where we are sure that we do not need
+ This method should be used in case where we are sure that we do not need
complete fix_fields() procedure.
- */
- inline void quick_fix_field() { fixed= 1; }
+ Usually this method is used by the optimizer when it has to create a new
+ item out of other already fixed items. For example, if the optimizer has
+ to create a new Item_func for an inferred equality whose left and right
+ parts are already fixed items. In some cases the optimizer cannot use
+ directly fixed items as the arguments of the created functional item,
+ but rather uses intermediate type conversion items. Then the method is
+ supposed to be applied recursively.
+ */
+ virtual inline void quick_fix_field() { fixed= 1; }
/* Function returns 1 on overflow and -1 on fatal errors */
int save_in_field_no_warnings(Field *field, bool no_conversions);
virtual int save_in_field(Field *field, bool no_conversions);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 389f2a25a2a..1db8f6e8da6 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -202,6 +202,21 @@ Item_func::fix_fields(THD *thd, Item **ref)
return FALSE;
}
+void
+Item_func::quick_fix_field()
+{
+ Item **arg,**arg_end;
+ if (arg_count)
+ {
+ for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
+ {
+ if (!(*arg)->fixed)
+ (*arg)->quick_fix_field();
+ }
+ }
+ fixed= 1;
+}
+
bool Item_func::walk(Item_processor processor, bool walk_subquery,
uchar *argument)
diff --git a/sql/item_func.h b/sql/item_func.h
index 792f31d4f39..99660bd2a40 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -117,6 +117,7 @@ public:
// Constructor used for Item_cond_and/or (see Item comment)
Item_func(THD *thd, Item_func *item);
bool fix_fields(THD *, Item **ref);
+ void quick_fix_field();
table_map used_tables() const;
table_map not_null_tables() const;
void update_used_tables();
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 61c5ab8d245..0cbccf3bedd 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -3233,12 +3233,17 @@ end_with_restore_list:
DBUG_EXECUTE_IF("after_mysql_insert",
{
- const char act[]=
+ const char act1[]=
"now "
"wait_for signal.continue";
+ const char act2[]=
+ "now "
+ "signal signal.continued";
DBUG_ASSERT(opt_debug_sync_timeout > 0);
- DBUG_ASSERT(!debug_sync_set_action(current_thd,
- STRING_WITH_LEN(act)));
+ DBUG_ASSERT(!debug_sync_set_action(thd,
+ STRING_WITH_LEN(act1)));
+ DBUG_ASSERT(!debug_sync_set_action(thd,
+ STRING_WITH_LEN(act2)));
};);
break;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3f88a6adf80..91d5f90a5f4 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -11214,6 +11214,11 @@ create_internal_tmp_table_from_heap2(THD *thd, TABLE *table,
DBUG_EXECUTE_IF("raise_error", write_err= HA_ERR_FOUND_DUPP_KEY ;);
if (write_err)
goto err;
+ if (thd->killed)
+ {
+ thd->send_kill_message();
+ goto err_killed;
+ }
}
/* copy row that filled HEAP table */
if ((write_err=new_table.file->ha_write_row(table->record[0])))
@@ -11244,6 +11249,7 @@ create_internal_tmp_table_from_heap2(THD *thd, TABLE *table,
err:
DBUG_PRINT("error",("Got error: %d",write_err));
table->file->print_error(write_err, MYF(0));
+err_killed:
(void) table->file->ha_rnd_end();
(void) new_table.file->close();
err1:
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index a9ed2a79df4..fcf78b4c5fb 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -7228,6 +7228,16 @@ view_err:
/* Non-primary unique key. */
needed_online_flags|= HA_ONLINE_ADD_UNIQUE_INDEX;
needed_fast_flags|= HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES;
+ if (ignore)
+ {
+ /*
+ If ignore is used, we have to remove all duplicate rows,
+ which require a full table copy.
+ */
+ need_copy_table= ALTER_TABLE_DATA_CHANGED;
+ pk_changed= 2; // Don't change need_copy_table
+ break;
+ }
}
}
else