summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2011-06-03 21:44:37 -0700
committerIgor Babaev <igor@askmonty.org>2011-06-03 21:44:37 -0700
commit35c35858f859f23c23a414cdb21fdfe39d5de11c (patch)
treea4fab4e0c5cd29a8db2ed55e26436ab3bb1e1a41 /sql
parentdd3b27834c271e9561fcde4658ce758c30c69334 (diff)
downloadmariadb-git-35c35858f859f23c23a414cdb21fdfe39d5de11c.tar.gz
Fixed bugs causing failures fot the funcs_1 test suite.
Uncommented the failing test cases. Commented out the failing test case from parts.partition_repair_myisam.test. The test case has to be changed to bear the same semantics as before mwl106.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_delete.cc10
-rw-r--r--sql/sql_lex.cc16
-rw-r--r--sql/sql_prepare.cc7
3 files changed, 28 insertions, 5 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 67eb7bc328d..c1996ee54f1 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -63,13 +63,15 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
if (mysql_handle_list_of_derived(thd->lex, table_list, DT_MERGE_FOR_INSERT) ||
mysql_handle_list_of_derived(thd->lex, table_list, DT_PREPARE))
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(TRUE);
+ if (!table_list->updatable)
+ {
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE");
+ DBUG_RETURN(TRUE);
+ }
if (!(table= table_list->table) || !table->created)
{
- if (!table_list->updatable)
- my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE");
- else
my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
table_list->view_db.str, table_list->view_name.str);
DBUG_RETURN(TRUE);
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 745a805d992..67c9883631f 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2370,6 +2370,22 @@ bool st_lex::can_be_merged()
/* find non VIEW subqueries/unions */
bool selects_allow_merge= select_lex.next_select() == 0;
+ if (selects_allow_merge)
+ {
+ for (SELECT_LEX_UNIT *tmp_unit= select_lex.first_inner_unit();
+ tmp_unit;
+ tmp_unit= tmp_unit->next_unit())
+ {
+ if (tmp_unit->first_select()->parent_lex == this &&
+ (tmp_unit->item == 0 ||
+ (tmp_unit->item->place() != IN_WHERE &&
+ tmp_unit->item->place() != IN_ON)))
+ {
+ selects_allow_merge= 0;
+ break;
+ }
+ }
+ }
return (selects_allow_merge &&
select_lex.group_list.elements == 0 &&
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 38fe809e357..7bec9d6577e 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1346,7 +1346,12 @@ static bool mysql_test_delete(Prepared_statement *stmt,
mysql_handle_list_of_derived(thd->lex, table_list, DT_PREPARE))
goto error;
- if (!table_list->table)
+ if (!table_list->updatable)
+ {
+ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE");
+ goto error;
+ }
+ if (!table_list->table || !table_list->table->created)
{
my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
table_list->view_db.str, table_list->view_name.str);