summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2008-05-29 21:39:25 +0300
committerunknown <monty@narttu.mysql.fi>2008-05-29 21:39:25 +0300
commitf83bd712ae864ed2fa2271247e56fc1f444c9801 (patch)
treed7dd11206d6de4fc93a1a73a66f7a15f32bb92d3 /sql
parent5ca17f0dc6235f03d9cbfcae087ac41d57fa4940 (diff)
parent5099033c26826fd2625b6424134999853e33a29d (diff)
downloadmariadb-git-f83bd712ae864ed2fa2271247e56fc1f444c9801.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-maria
into mysql.com:/home/my/mysql-maria mysql-test/r/maria.result: Auto merged mysql-test/suite/ndb/r/ndb_auto_increment.result: Auto merged mysql-test/t/maria.test: Auto merged mysys/hash.c: Auto merged mysys/thr_lock.c: Auto merged sql/field.cc: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/ha_ndbcluster.h: Auto merged sql/ha_partition.cc: Auto merged sql/ha_partition.h: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/log_event.cc: Auto merged sql/log_event_old.cc: Auto merged sql/mysqld.cc: Auto merged sql/protocol.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged storage/csv/ha_tina.cc: Auto merged storage/federated/ha_federated.cc: Auto merged storage/maria/Makefile.am: Auto merged storage/maria/ma_check.c: Auto merged storage/maria/ma_control_file.c: Auto merged storage/maria/ma_delete_all.c: Auto merged storage/maria/ma_dynrec.c: Auto merged storage/maria/ma_init.c: Auto merged storage/maria/ma_key_recover.c: Auto merged storage/maria/ma_open.c: Auto merged storage/maria/ma_page.c: Auto merged storage/maria/ma_range.c: Auto merged storage/maria/ma_recovery.c: Auto merged storage/maria/ma_test1.c: Auto merged storage/maria/maria_read_log.c: Auto merged storage/maria/unittest/ma_test_all-t: Auto merged storage/maria/unittest/ma_test_loghandler_multigroup-t.c: Auto merged storage/maria/unittest/ma_test_recovery.pl: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/myisamdef.h: Auto merged include/my_base.h: Manual merge where error code are kept same as in 5.1 mysys/my_handler.c: No changes sql/item.cc: Manual merge sql/sql_class.cc: Manual merge sql/sql_insert.cc: Manual merge storage/maria/ha_maria.cc: Manual merge storage/maria/ma_blockrec.c: Manual merge storage/maria/ma_delete.c: Manual merge storage/maria/ma_write.c: Manual merge
Diffstat (limited to 'sql')
-rw-r--r--sql/field.cc2
-rw-r--r--sql/ha_ndbcluster.cc6
-rw-r--r--sql/ha_ndbcluster.h2
-rw-r--r--sql/ha_partition.cc5
-rw-r--r--sql/ha_partition.h2
-rw-r--r--sql/handler.cc11
-rw-r--r--sql/handler.h6
-rw-r--r--sql/item.cc16
-rw-r--r--sql/log_event.cc2
-rw-r--r--sql/log_event_old.cc4
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/protocol.cc2
-rw-r--r--sql/sql_class.cc13
-rw-r--r--sql/sql_insert.cc14
-rw-r--r--sql/sql_load.cc2
-rw-r--r--sql/sql_parse.cc19
-rw-r--r--sql/sql_select.cc23
-rw-r--r--sql/sql_select.h3
-rw-r--r--sql/sql_table.cc4
-rw-r--r--sql/sql_yacc.yy10
20 files changed, 96 insertions, 52 deletions
diff --git a/sql/field.cc b/sql/field.cc
index f955cf15eb9..6b29314501f 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5391,7 +5391,7 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
int Field_year::store(double nr)
{
- if (nr < 0.0 || nr >= 2155.0)
+ if (nr < 0.0 || nr > 2155.0)
{
(void) Field_year::store((longlong) -1, FALSE);
return 1;
diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc
index 1cfe403407e..4e1300c044c 100644
--- a/sql/ha_ndbcluster.cc
+++ b/sql/ha_ndbcluster.cc
@@ -4230,11 +4230,11 @@ void ha_ndbcluster::start_bulk_insert(ha_rows rows)
/**
End of an insert.
*/
-int ha_ndbcluster::end_bulk_insert()
+int ha_ndbcluster::end_bulk_insert(bool abort)
{
int error= 0;
-
DBUG_ENTER("end_bulk_insert");
+
// Check if last inserts need to be flushed
if (m_bulk_insert_not_flushed)
{
@@ -4586,7 +4586,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
Thd_ndb *thd_ndb= get_thd_ndb(thd);
Ndb *ndb= thd_ndb->ndb;
- DBUG_PRINT("enter", ("this: 0x%lx thd: 0x%lx thd_ndb: %lx "
+ DBUG_PRINT("enter", ("this: 0x%lx thd: 0x%lx thd_ndb: 0x%lx "
"thd_ndb->lock_count: %d",
(long) this, (long) thd, (long) thd_ndb,
thd_ndb->lock_count));
diff --git a/sql/ha_ndbcluster.h b/sql/ha_ndbcluster.h
index a17323d3fd6..f3651ebeca9 100644
--- a/sql/ha_ndbcluster.h
+++ b/sql/ha_ndbcluster.h
@@ -322,7 +322,7 @@ class ha_ndbcluster: public handler
double scan_time();
ha_rows records_in_range(uint inx, key_range *min_key, key_range *max_key);
void start_bulk_insert(ha_rows rows);
- int end_bulk_insert();
+ int end_bulk_insert(bool abort);
static Thd_ndb* seize_thd_ndb();
static void release_thd_ndb(Thd_ndb* thd_ndb);
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 3045d5d73a9..c90f82d24a1 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -3025,13 +3025,14 @@ void ha_partition::start_bulk_insert(ha_rows rows)
SYNOPSIS
end_bulk_insert()
+ abort 1 if table will be deleted (error condition)
RETURN VALUE
>0 Error code
0 Success
*/
-int ha_partition::end_bulk_insert()
+int ha_partition::end_bulk_insert(bool abort)
{
int error= 0;
handler **file;
@@ -3041,7 +3042,7 @@ int ha_partition::end_bulk_insert()
do
{
int tmp;
- if ((tmp= (*file)->ha_end_bulk_insert()))
+ if ((tmp= (*file)->ha_end_bulk_insert(abort)))
error= tmp;
} while (*(++file));
DBUG_RETURN(error);
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index ac00581fae0..5a8caaeb209 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -315,7 +315,7 @@ public:
virtual int delete_row(const uchar * buf);
virtual int delete_all_rows(void);
virtual void start_bulk_insert(ha_rows rows);
- virtual int end_bulk_insert();
+ virtual int end_bulk_insert(bool);
virtual bool is_fatal_error(int error, uint flags)
{
diff --git a/sql/handler.cc b/sql/handler.cc
index 1fee2012542..f637ebfb02e 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2527,11 +2527,14 @@ void handler::print_error(int error, myf errflag)
break;
case HA_ERR_FOUND_DUPP_KEY:
{
- uint key_nr=get_dup_key(error);
- if ((int) key_nr >= 0)
+ if (table)
{
- print_keydup_error(key_nr, ER(ER_DUP_ENTRY_WITH_KEY_NAME));
- DBUG_VOID_RETURN;
+ uint key_nr=get_dup_key(error);
+ if ((int) key_nr >= 0)
+ {
+ print_keydup_error(key_nr, ER(ER_DUP_ENTRY_WITH_KEY_NAME));
+ DBUG_VOID_RETURN;
+ }
}
textno=ER_DUP_KEY;
break;
diff --git a/sql/handler.h b/sql/handler.h
index 63923733c4d..b2234dc4b75 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1216,10 +1216,10 @@ public:
estimation_rows_to_insert= rows;
start_bulk_insert(rows);
}
- int ha_end_bulk_insert()
+ int ha_end_bulk_insert(bool abort)
{
estimation_rows_to_insert= 0;
- return end_bulk_insert();
+ return end_bulk_insert(abort);
}
int ha_bulk_update_row(const uchar *old_data, uchar *new_data,
uint *dup_key_found);
@@ -1844,7 +1844,7 @@ private:
virtual int repair(THD* thd, HA_CHECK_OPT* check_opt)
{ return HA_ADMIN_NOT_IMPLEMENTED; }
virtual void start_bulk_insert(ha_rows rows) {}
- virtual int end_bulk_insert() { return 0; }
+ virtual int end_bulk_insert(bool abort) { return 0; }
virtual int index_read(uchar * buf, const uchar * key, uint key_len,
enum ha_rkey_function find_flag)
{ return HA_ERR_WRONG_COMMAND; }
diff --git a/sql/item.cc b/sql/item.cc
index f2dc1238ff0..9d75e55c9a3 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1468,7 +1468,9 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
if (collation == &my_charset_bin)
{
if (derivation <= dt.derivation)
- ; // Do nothing
+ {
+ /* Do nothing */
+ }
else
{
set(dt);
@@ -1480,15 +1482,11 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
{
set(dt);
}
- else
- {
- // Do nothing
- }
}
else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
left_is_superset(this, &dt))
{
- // Do nothing
+ /* Do nothing */
}
else if ((flags & MY_COLL_ALLOW_SUPERSET_CONV) &&
left_is_superset(&dt, this))
@@ -1499,7 +1497,7 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
derivation < dt.derivation &&
dt.derivation >= DERIVATION_SYSCONST)
{
- // Do nothing;
+ /* Do nothing */
}
else if ((flags & MY_COLL_ALLOW_COERCIBLE_CONV) &&
dt.derivation < derivation &&
@@ -1516,7 +1514,7 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
}
else if (derivation < dt.derivation)
{
- // Do nothing
+ /* Do nothing */
}
else if (dt.derivation < derivation)
{
@@ -1526,7 +1524,7 @@ bool DTCollation::aggregate(DTCollation &dt, uint flags)
{
if (collation == dt.collation)
{
- // Do nothing
+ /* Do nothing */
}
else
{
diff --git a/sql/log_event.cc b/sql/log_event.cc
index 944d99d7a74..32cf735ea3f 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -7612,7 +7612,7 @@ Write_rows_log_event::do_after_row_operations(const Slave_reporting_capability *
ultimately. Still todo: fix
*/
}
- if ((local_error= m_table->file->ha_end_bulk_insert()))
+ if ((local_error= m_table->file->ha_end_bulk_insert(0)))
{
m_table->file->print_error(local_error, MYF(0));
}
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 808356a05c7..3596b21cb30 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -962,7 +962,7 @@ int Write_rows_log_event_old::do_after_row_operations(TABLE *table, int error)
fires bug#27077
todo: explain or fix
*/
- if ((local_error= table->file->ha_end_bulk_insert()))
+ if ((local_error= table->file->ha_end_bulk_insert(0)))
{
table->file->print_error(local_error, MYF(0));
}
@@ -2633,7 +2633,7 @@ Write_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabili
fires bug#27077
todo: explain or fix
*/
- if ((local_error= m_table->file->ha_end_bulk_insert()))
+ if ((local_error= m_table->file->ha_end_bulk_insert(0)))
{
m_table->file->print_error(local_error, MYF(0));
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 9dadd15bfbe..a19cde65e2b 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -2890,7 +2890,7 @@ int my_message_sql(uint error, const char *str, myf MyFlags)
}
}
to_error_log:
- if (!thd || MyFlags & ME_NOREFRESH)
+ if (!thd || (MyFlags & ME_NOREFRESH))
(*func)("%s: %s", my_progname_short, str); /* purecov: inspected */
DBUG_RETURN(0);
}
diff --git a/sql/protocol.cc b/sql/protocol.cc
index 5fe56724d08..c98ad72fffe 100644
--- a/sql/protocol.cc
+++ b/sql/protocol.cc
@@ -383,6 +383,7 @@ static uchar *net_store_length_fast(uchar *packet, uint length)
void net_end_statement(THD *thd)
{
+ DBUG_ENTER("net_end_statement");
DBUG_ASSERT(! thd->main_da.is_sent);
/* Can not be true, but do not take chances in production. */
@@ -419,6 +420,7 @@ void net_end_statement(THD *thd)
break;
}
thd->main_da.is_sent= TRUE;
+ DBUG_VOID_RETURN;
}
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index fb08b2e81b3..3ca0fef4b50 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -369,6 +369,7 @@ char *thd_security_context(THD *thd, char *buffer, unsigned int length,
void
Diagnostics_area::reset_diagnostics_area()
{
+ DBUG_ENTER("reset_diagnostics_area");
#ifdef DBUG_OFF
can_overwrite_status= FALSE;
/** Don't take chances in production */
@@ -382,6 +383,7 @@ Diagnostics_area::reset_diagnostics_area()
is_sent= FALSE;
/** Tiny reset in debug mode to see garbage right away */
m_status= DA_EMPTY;
+ DBUG_VOID_RETURN;
}
@@ -395,6 +397,7 @@ Diagnostics_area::set_ok_status(THD *thd, ha_rows affected_rows_arg,
ulonglong last_insert_id_arg,
const char *message_arg)
{
+ DBUG_ENTER("set_ok_status");
DBUG_ASSERT(! is_set());
/*
In production, refuse to overwrite an error or a custom response
@@ -412,6 +415,7 @@ Diagnostics_area::set_ok_status(THD *thd, ha_rows affected_rows_arg,
else
m_message[0]= '\0';
m_status= DA_OK;
+ DBUG_VOID_RETURN;
}
@@ -422,8 +426,8 @@ Diagnostics_area::set_ok_status(THD *thd, ha_rows affected_rows_arg,
void
Diagnostics_area::set_eof_status(THD *thd)
{
- /** Only allowed to report eof if has not yet reported an error */
-
+ DBUG_ENTER("set_eof_status");
+ /* Only allowed to report eof if has not yet reported an error */
DBUG_ASSERT(! is_set());
/*
In production, refuse to overwrite an error or a custom response
@@ -441,6 +445,7 @@ Diagnostics_area::set_eof_status(THD *thd)
m_total_warn_count= thd->spcont ? 0 : thd->total_warn_count;
m_status= DA_EOF;
+ DBUG_VOID_RETURN;
}
/**
@@ -451,6 +456,7 @@ void
Diagnostics_area::set_error_status(THD *thd, uint sql_errno_arg,
const char *message_arg)
{
+ DBUG_ENTER("set_error_status");
/*
Only allowed to report error if has not yet reported a success
The only exception is when we flush the message to the client,
@@ -467,9 +473,10 @@ Diagnostics_area::set_error_status(THD *thd, uint sql_errno_arg,
#endif
m_sql_errno= sql_errno_arg;
- strmake(m_message, message_arg, sizeof(m_message) - 1);
+ strmake(m_message, message_arg, sizeof(m_message)-1);
m_status= DA_ERROR;
+ DBUG_VOID_RETURN;
}
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index dbfe3cc6d79..61ce6b04832 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -559,6 +559,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
bool transactional_table, joins_freed= FALSE;
bool changed;
bool was_insert_delayed= (table_list->lock_type == TL_WRITE_DELAYED);
+ bool using_bulk_insert= 0;
uint value_count;
ulong counter = 1;
ulonglong id;
@@ -724,8 +725,11 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
{
if (duplic != DUP_ERROR || ignore)
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);
- if (!thd->prelocked_mode)
+ if (!thd->prelocked_mode && values_list.elements > 1)
+ {
+ using_bulk_insert= 1;
table->file->ha_start_bulk_insert(values_list.elements);
+ }
}
thd->abort_on_warning= (!ignore && (thd->variables.sql_mode &
@@ -840,7 +844,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
auto_inc values from the delayed_insert thread as they share TABLE.
*/
table->file->ha_release_auto_increment();
- if (!thd->prelocked_mode && table->file->ha_end_bulk_insert() && !error)
+ if (using_bulk_insert && table->file->ha_end_bulk_insert(0) && !error)
{
table->file->print_error(my_errno,MYF(0));
error=1;
@@ -1173,7 +1177,7 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
bool res= 0;
table_map map= 0;
DBUG_ENTER("mysql_prepare_insert");
- DBUG_PRINT("enter", ("table_list 0x%lx, table 0x%lx, view %d",
+ DBUG_PRINT("enter", ("table_list 0x%lx table 0x%lx view %d",
(ulong)table_list, (ulong)table,
(int)insert_into_view));
/* INSERT should have a SELECT or VALUES clause */
@@ -3133,7 +3137,7 @@ bool select_insert::send_eof()
DBUG_PRINT("enter", ("trans_table=%d, table_type='%s'",
trans_table, table->file->table_type()));
- error= (!thd->prelocked_mode) ? table->file->ha_end_bulk_insert():0;
+ error= (!thd->prelocked_mode) ? table->file->ha_end_bulk_insert(0) : 0;
table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
@@ -3208,7 +3212,7 @@ void select_insert::abort() {
before.
*/
if (!thd->prelocked_mode)
- table->file->ha_end_bulk_insert();
+ table->file->ha_end_bulk_insert(0);
/*
If at least one row has been inserted/modified and will stay in
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 5c77848722d..49015fb3e2a 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -393,7 +393,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
error= read_sep_field(thd, info, table_list, fields_vars,
set_fields, set_values, read_info,
*enclosed, skip_lines, ignore);
- if (!thd->prelocked_mode && table->file->ha_end_bulk_insert() && !error)
+ if (!thd->prelocked_mode && table->file->ha_end_bulk_insert(0) && !error)
{
table->file->print_error(my_errno, MYF(0));
error= 1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 712bdc85ae3..7cc2c928521 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2600,10 +2600,12 @@ end_with_restore_list:
#endif /* HAVE_REPLICATION */
case SQLCOM_ALTER_TABLE:
- DBUG_ASSERT(first_table == all_tables && first_table != 0);
{
ulong priv=0;
ulong priv_needed= ALTER_ACL;
+
+ DBUG_ASSERT(first_table == all_tables && first_table != 0);
+
/*
Code in mysql_alter_table() may modify its HA_CREATE_INFO argument,
so we have to use a copy of this structure to make execution
@@ -2613,7 +2615,7 @@ end_with_restore_list:
HA_CREATE_INFO create_info(lex->create_info);
Alter_info alter_info(lex->alter_info, thd->mem_root);
- if (thd->is_fatal_error) /* out of memory creating a copy of alter_info */
+ if (thd->is_fatal_error) /* OOM creating a copy of alter_info */
goto error;
/*
We also require DROP priv for ALTER TABLE ... DROP PARTITION, as well
@@ -4695,11 +4697,6 @@ create_sp_error:
if (!(sql_command_flags[lex->sql_command] & CF_HAS_ROW_COUNT))
thd->row_count_func= -1;
- goto finish;
-
-error:
- res= TRUE;
-
finish:
if (need_start_waiting)
{
@@ -4710,6 +4707,11 @@ finish:
start_waiting_global_read_lock(thd);
}
DBUG_RETURN(res || thd->is_error());
+
+error:
+ thd_proc_info(thd, "query end");
+ res= TRUE;
+ goto finish;
}
@@ -7420,6 +7422,7 @@ bool parse_sql(THD *thd,
Lex_input_stream *lip,
Object_creation_ctx *creation_ctx)
{
+ bool mysql_parse_status;
DBUG_ASSERT(thd->m_lip == NULL);
/* Backup creation context. */
@@ -7435,7 +7438,7 @@ bool parse_sql(THD *thd,
/* Parse the query. */
- bool mysql_parse_status= MYSQLparse(thd) != 0;
+ mysql_parse_status= MYSQLparse(thd) != 0;
/* Check that if MYSQLparse() failed, thd->is_error() is set. */
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index a6e7cc33b51..5b6e779ec1b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1798,7 +1798,10 @@ JOIN::exec()
curr_join->having= curr_join->tmp_having= 0; // Allready done
/* Change sum_fields reference to calculated fields in tmp_table */
- curr_join->all_fields= *curr_all_fields;
+#ifdef HAVE_purify
+ if (curr_join != this)
+#endif
+ curr_join->all_fields= *curr_all_fields;
if (!items1)
{
items1= items0 + all_fields.elements;
@@ -1816,8 +1819,13 @@ JOIN::exec()
fields_list.elements, all_fields))
DBUG_VOID_RETURN;
}
- curr_join->tmp_all_fields1= tmp_all_fields1;
- curr_join->tmp_fields_list1= tmp_fields_list1;
+#ifdef HAVE_purify
+ if (curr_join != this)
+#endif
+ {
+ curr_join->tmp_all_fields1= tmp_all_fields1;
+ curr_join->tmp_fields_list1= tmp_fields_list1;
+ }
curr_join->items1= items1;
}
curr_all_fields= &tmp_all_fields1;
@@ -2021,8 +2029,13 @@ JOIN::exec()
tmp_table_param.save_copy_field= curr_join->tmp_table_param.copy_field;
tmp_table_param.save_copy_field_end=
curr_join->tmp_table_param.copy_field_end;
- curr_join->tmp_all_fields3= tmp_all_fields3;
- curr_join->tmp_fields_list3= tmp_fields_list3;
+#ifdef HAVE_purify
+ if (curr_join != this)
+#endif
+ {
+ curr_join->tmp_all_fields3= tmp_all_fields3;
+ curr_join->tmp_fields_list3= tmp_fields_list3;
+ }
}
else
{
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 687ce575ebd..3c3b728f980 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -459,7 +459,8 @@ public:
group_optimized_away= 0;
all_fields= fields_arg;
- fields_list= fields_arg;
+ if (&fields_list != &fields_arg) /* Avoid valgrind-warning */
+ fields_list= fields_arg;
bzero((char*) &keyuse,sizeof(keyuse));
tmp_table_param.init();
tmp_table_param.end_write_records= HA_POS_ERROR;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index bc4e6dfbbcc..fbce42fd452 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -7179,7 +7179,9 @@ err:
free_io_cache(from);
delete [] copy;
- if (errpos >= 3 && to->file->ha_end_bulk_insert() && error <= 0)
+ if (error > 0)
+ to->file->extra(HA_EXTRA_PREPARE_FOR_DROP);
+ if (errpos >= 3 && to->file->ha_end_bulk_insert(error > 1) && error <= 0)
{
to->file->print_error(my_errno,MYF(0));
error=1;
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 58483a33582..c23049017e2 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -11215,6 +11215,16 @@ table_lock:
lock_option:
READ_SYM { $$= TL_READ_NO_INSERT; }
| WRITE_SYM { $$= TL_WRITE_DEFAULT; }
+ | WRITE_SYM CONCURRENT
+ {
+#ifdef HAVE_QUERY_CACHE
+ if (Lex->sphead != 0)
+ $$= TL_WRITE_DEFAULT;
+ else
+#endif
+ $$= TL_WRITE_CONCURRENT_INSERT;
+ }
+
| LOW_PRIORITY WRITE_SYM { $$= TL_WRITE_LOW_PRIORITY; }
| READ_SYM LOCAL_SYM { $$= TL_READ; }
;