summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc44
1 files changed, 33 insertions, 11 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 6a313616025..dec5bd91f36 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1316,7 +1316,12 @@ bool wait_while_table_is_used(THD *thd, TABLE *table,
table->s->tdc->flush(thd, true);
/* extra() call must come only after all instances above are closed */
if (function != HA_EXTRA_NOT_USED)
- DBUG_RETURN(table->file->extra(function));
+ {
+ int error= table->file->extra(function);
+ if (error)
+ table->file->print_error(error, MYF(0));
+ DBUG_RETURN(error);
+ }
DBUG_RETURN(FALSE);
}
@@ -1777,7 +1782,14 @@ bool open_table(THD *thd, TABLE_LIST *table_list, Open_table_context *ot_ctx)
}
if (is_locked_view(thd, table_list))
+ {
+ if (table_list->sequence)
+ {
+ my_error(ER_NOT_SEQUENCE, MYF(0), table_list->db.str, table_list->alias.str);
+ DBUG_RETURN(true);
+ }
DBUG_RETURN(FALSE); // VIEW
+ }
/*
No table in the locked tables list. In case of explicit LOCK TABLES
@@ -1906,7 +1918,12 @@ retry_share:
DBUG_RETURN(FALSE);
}
+#ifdef WITH_WSREP
+ if (!((flags & MYSQL_OPEN_IGNORE_FLUSH) ||
+ (thd->wsrep_applier)))
+#else
if (!(flags & MYSQL_OPEN_IGNORE_FLUSH))
+#endif
{
if (share->tdc->flushed)
{
@@ -3900,7 +3917,8 @@ static bool upgrade_lock_if_not_exists(THD *thd,
{
DEBUG_SYNC(thd,"create_table_before_check_if_exists");
if (!create_info.or_replace() &&
- ha_table_exists(thd, &create_table->db, &create_table->table_name))
+ ha_table_exists(thd, &create_table->db, &create_table->table_name,
+ &create_table->db_type))
{
if (create_info.if_not_exists())
{
@@ -3948,7 +3966,8 @@ static bool upgrade_lock_if_not_exists(THD *thd,
Note that for CREATE TABLE IF EXISTS we only generate a warning
but still return TRUE (to abort the calling open_table() function).
On must check THD->is_error() if one wants to distinguish between warning
- and error.
+ and error. If table existed, tables_start->db_type is set to the handlerton
+ for the found table.
*/
bool
@@ -8734,14 +8753,17 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
goto err;
field->set_has_explicit_value();
}
- /* Update virtual fields */
- thd->abort_on_warning= FALSE;
- if (table->versioned())
- table->vers_update_fields();
- if (table->vfield &&
- table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_WRITE))
- goto err;
- thd->abort_on_warning= abort_on_warning_saved;
+ /* Update virtual fields if there wasn't any errors */
+ if (!thd->is_error())
+ {
+ thd->abort_on_warning= FALSE;
+ if (table->versioned())
+ table->vers_update_fields();
+ if (table->vfield &&
+ table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_WRITE))
+ goto err;
+ thd->abort_on_warning= abort_on_warning_saved;
+ }
DBUG_RETURN(thd->is_error());
err: