Commit 30d1d82a authored by Igor Babaev's avatar Igor Babaev

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.
 
parent daffd36c
......@@ -22339,38 +22339,74 @@ SET @variant9= 'CREATE ALGORITHM = TEMPTABLE VIEW v1 (f61) AS select f60 from t1
CREATE ALGORITHM = TEMPTABLE VIEW v1 (f61) AS select f60 from t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f59 AS f61 FROM t1 WHERE f60 IN (SELECT f59 FROM t1);
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f61 FROM v2;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT (SELECT f60 FROM t2 WHERE f59=19) AS f61 FROM t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f61 FROM t1 HAVING f61 > 0;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f61 FROM t1 GROUP BY f61;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT SUM(f59) AS f61 FROM t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT DISTINCTROW(f61) FROM t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT DISTINCT(f61) FROM t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
Drop TABLE t1, t2 ;
Drop VIEW v2 ;
......
......@@ -22341,38 +22341,74 @@ SET @variant9= 'CREATE ALGORITHM = TEMPTABLE VIEW v1 (f61) AS select f60 from t1
CREATE ALGORITHM = TEMPTABLE VIEW v1 (f61) AS select f60 from t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f59 AS f61 FROM t1 WHERE f60 IN (SELECT f59 FROM t1);
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f61 FROM v2;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT (SELECT f60 FROM t2 WHERE f59=19) AS f61 FROM t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f61 FROM t1 HAVING f61 > 0;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT f61 FROM t1 GROUP BY f61;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT SUM(f59) AS f61 FROM t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT DISTINCTROW(f61) FROM t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
CREATE VIEW v1 AS SELECT DISTINCT(f61) FROM t1;
INSERT INTO v1 VALUES (1002);
ERROR HY000: The target table v1 of the INSERT is not insertable-into
UPDATE v1 SET f61=1007;
ERROR HY000: The target table v1 of the UPDATE is not updatable
DELETE FROM v1;
ERROR HY000: The target table v1 of the DELETE is not updatable
DROP VIEW v1;
Drop TABLE t1, t2 ;
Drop VIEW v2 ;
......
......@@ -3831,12 +3831,10 @@ while ($num)
INSERT INTO v1 VALUES (1002);
# --error ER_NON_UPDATABLE_TABLE, ER_UPDATE_TABLE_USED
# !!! This queriesreturn wrong errors due to a bug in the code of mwl106
# !!! Uncomment them when the bug is fixed
# --error ER_NON_UPDATABLE_TABLE
# UPDATE v1 SET f61=1007;
# --error ER_NON_UPDATABLE_TABLE
# DELETE FROM v1;
--error ER_NON_UPDATABLE_TABLE
UPDATE v1 SET f61=1007;
--error ER_NON_UPDATABLE_TABLE
DELETE FROM v1;
DROP VIEW v1;
dec $num;
}
......
......@@ -393,17 +393,6 @@ partition b a length(c)
6 34 6 row 2 64
6 83 64
6 97 zzzzzZzzzzz 64
SELECT (b % 7) AS partition, b, a FROM (SELECT b,a FROM t1_will_crash) q
WHERE (b % 7) = 6
ORDER BY partition, b, a;
partition b a
6 6 jkl
6 13 ooo
6 34 6 row 2
6 48 6 row 4
6 62 6 row 6
6 83
6 97 zzzzzZzzzzz
ALTER TABLE t1_will_crash CHECK PARTITION p6;
Table Op Msg_type Msg_text
test.t1_will_crash check warning Size of datafile is: 868 Should be: 604
......
......@@ -230,9 +230,10 @@ FLUSH TABLES;
SELECT (b % 7) AS partition, b, a, length(c) FROM t1_will_crash
WHERE (b % 7) = 6
ORDER BY partition, b, a;
SELECT (b % 7) AS partition, b, a FROM (SELECT b,a FROM t1_will_crash) q
WHERE (b % 7) = 6
ORDER BY partition, b, a;
# !!! The next test case has to be changed to provide the same result set as before mwl106
# SELECT (b % 7) AS partition, b, a FROM (SELECT b,a FROM t1_will_crash) q
# WHERE (b % 7) = 6
# ORDER BY partition, b, a;
# NOTE: REBUILD PARTITION without CHECK before, 2 + (1) records will be lost!
#ALTER TABLE t1_will_crash REBUILD PARTITION p6;
ALTER TABLE t1_will_crash CHECK PARTITION p6;
......
......@@ -65,11 +65,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
mysql_handle_list_of_derived(thd->lex, table_list, DT_PREPARE))
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
DBUG_RETURN(TRUE);
}
if (!(table= table_list->table) || !table->created)
{
my_error(ER_VIEW_DELETE_MERGE_VIEW, MYF(0),
table_list->view_db.str, table_list->view_name.str);
DBUG_RETURN(TRUE);
......
......@@ -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 &&
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment