summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/filesort.cc2
-rw-r--r--sql/item_cmpfunc.cc13
-rw-r--r--sql/sql_db.cc6
-rw-r--r--sql/sql_select.cc12
-rw-r--r--sql/sql_table.cc27
5 files changed, 34 insertions, 26 deletions
diff --git a/sql/filesort.cc b/sql/filesort.cc
index 75da43afed5..ad784c729fa 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -466,7 +466,7 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
my_store_ptr(ref_pos,ref_length,record); // Position to row
record+= sort_form->s->db_record_offset;
}
- else
+ else if (!error)
file->position(sort_form->record[0]);
}
if (error && error != HA_ERR_RECORD_DELETED)
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 78a512d0ddb..1f56e02f1cb 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1017,8 +1017,8 @@ longlong Item_func_interval::val_int()
1 got error
*/
-bool
-Item_func_between::fix_fields(THD *thd, Item **ref)
+bool Item_func_between::fix_fields(THD *thd, struct st_table_list *tables,
+ Item **ref)
{
if (Item_func_opt_neg::fix_fields(thd, ref))
return 1;
@@ -1028,8 +1028,9 @@ Item_func_between::fix_fields(THD *thd, Item **ref)
return 0;
/* not_null_tables_cache == union(T1(e), intersection(T1(e1),T1(e2))) */
- not_null_tables_cache= args[0]->not_null_tables() |
- (args[1]->not_null_tables() & args[2]->not_null_tables());
+ not_null_tables_cache= (args[0]->not_null_tables() |
+ (args[1]->not_null_tables() &
+ args[2]->not_null_tables()));
return 0;
}
@@ -1330,8 +1331,8 @@ Item_func_if::fix_fields(THD *thd, Item **ref)
if (Item_func::fix_fields(thd, ref))
return 1;
- not_null_tables_cache= (args[1]->not_null_tables()
- & args[2]->not_null_tables());
+ not_null_tables_cache= (args[1]->not_null_tables() &
+ args[2]->not_null_tables());
return 0;
}
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index f24e2cdc0ad..69ccbe690db 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -437,7 +437,11 @@ bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
error= -1;
goto exit;
}
- result= 0;
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_DB_CREATE_EXISTS, ER(ER_DB_CREATE_EXISTS), db);
+ error= 0;
+ send_ok(thd);
+ goto exit;
}
else
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c012d90a2a5..04969b37012 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13073,12 +13073,12 @@ static bool change_group_ref(THD *thd, Item_func *expr, ORDER *group_list,
{
Name_resolution_context *context= &thd->lex->current_select->context;
Item **arg,**arg_end;
+ bool arg_changed= FALSE;
for (arg= expr->arguments(),
arg_end= expr->arguments()+expr->arg_count;
arg != arg_end; arg++)
{
Item *item= *arg;
- bool arg_changed= FALSE;
if (item->type() == Item::FIELD_ITEM || item->type() == Item::REF_ITEM)
{
ORDER *group_tmp;
@@ -13100,11 +13100,11 @@ static bool change_group_ref(THD *thd, Item_func *expr, ORDER *group_list,
if (change_group_ref(thd, (Item_func *) item, group_list, &arg_changed))
return 1;
}
- if (arg_changed)
- {
- expr->maybe_null= 1;
- *changed= TRUE;
- }
+ }
+ if (arg_changed)
+ {
+ expr->maybe_null= 1;
+ *changed= TRUE;
}
}
return 0;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index da10dcd3109..611ab0f16aa 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1562,6 +1562,9 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{
create_info->table_existed= 1; // Mark that table existed
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ alias);
DBUG_RETURN(FALSE);
}
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
@@ -1575,12 +1578,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
if (!access(path,F_OK))
{
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
- {
- create_info->table_existed= 1; // Mark that table existed
- error= FALSE;
- }
- else
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
+ goto warn;
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
goto end;
}
}
@@ -1603,12 +1602,8 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
DBUG_PRINT("info", ("Table with same name already existed in handler"));
if (create_if_not_exists)
- {
- create_info->table_existed= 1; // Mark that table existed
- error= FALSE;
- }
- else
- my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
+ goto warn;
+ my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
goto end;
}
}
@@ -1641,6 +1636,14 @@ bool mysql_create_table(THD *thd,const char *db, const char *table_name,
mysql_bin_log.write(&qinfo);
}
error= FALSE;
+ goto end;
+
+warn:
+ error= 0;
+ push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
+ ER_TABLE_EXISTS_ERROR, ER(ER_TABLE_EXISTS_ERROR),
+ alias);
+ create_info->table_existed= 1; // Mark that table existed
end:
VOID(pthread_mutex_unlock(&LOCK_open));