diff options
author | unknown <bell@sanja.is.com.ua> | 2004-01-04 23:44:33 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-01-04 23:44:33 +0200 |
commit | d2b540a75f4433ac5d4f81b521b46db98d56bc68 (patch) | |
tree | 198037221b84d6cf0f9081cad662a648b171c5a6 /mysql-test/t/derived.test | |
parent | 14a493771d3e18b77bc762a63de761608437f0ea (diff) | |
download | mariadb-git-d2b540a75f4433ac5d4f81b521b46db98d56bc68.tar.gz |
allow UPDATE and DELETE stetements with tables derived from subquery if they are not updated (BUG#2117)
allow delete table by alias in multi-delete statement
include/mysqld_error.h:
new error message about non-updateable table
mysql-test/r/derived.result:
test of multi-update and multi-delete
mysql-test/t/derived.test:
test of multi-update and multi-delete
sql/share/czech/errmsg.txt:
new error message about non-updateable table
sql/share/danish/errmsg.txt:
new error message about non-updateable table
sql/share/dutch/errmsg.txt:
new error message about non-updateable table
sql/share/english/errmsg.txt:
new error message about non-updateable table
sql/share/estonian/errmsg.txt:
new error message about non-updateable table
sql/share/french/errmsg.txt:
new error message about non-updateable table
sql/share/german/errmsg.txt:
new error message about non-updateable table
sql/share/greek/errmsg.txt:
new error message about non-updateable table
sql/share/hungarian/errmsg.txt:
new error message about non-updateable table
sql/share/italian/errmsg.txt:
new error message about non-updateable table
sql/share/japanese/errmsg.txt:
new error message about non-updateable table
sql/share/korean/errmsg.txt:
new error message about non-updateable table
sql/share/norwegian-ny/errmsg.txt:
new error message about non-updateable table
sql/share/norwegian/errmsg.txt:
new error message about non-updateable table
sql/share/polish/errmsg.txt:
new error message about non-updateable table
sql/share/portuguese/errmsg.txt:
new error message about non-updateable table
sql/share/romanian/errmsg.txt:
new error message about non-updateable table
sql/share/russian/errmsg.txt:
new error message about non-updateable table
sql/share/serbian/errmsg.txt:
new error message about non-updateable table
sql/share/slovak/errmsg.txt:
new error message about non-updateable table
sql/share/spanish/errmsg.txt:
new error message about non-updateable table
sql/share/swedish/errmsg.txt:
new error message about non-updateable table
sql/share/ukrainian/errmsg.txt:
new error message about non-updateable table
sql/sql_parse.cc:
allow delete table by alias
separate error message for try to delete derived table
sql/sql_update.cc:
test "is updated table derived?"
sql/sql_yacc.yy:
error message in case of try to update derived table
Diffstat (limited to 'mysql-test/t/derived.test')
-rw-r--r-- | mysql-test/t/derived.test | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index caf673d95c1..77e76d16772 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -115,7 +115,7 @@ select mail_id, if(folder.f_description!='', folder.f_description, folder.f_nam # create table t1 (a int); insert into t1 values (1),(2),(3); --- error 1149 +-- error 1287 update (select * from t1) as t1 set a = 5; -- error 1064 delete from (select * from t1); @@ -138,3 +138,22 @@ insert into t1 values (1),(2); select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b; explain select * from ( select * from t1 union select * from t1) a,(select * from t1 union select * from t1) b; drop table t1; + + +# +# multi-update & multi-delete with derived tables +# +CREATE TABLE `t1` ( + `N` int(11) unsigned NOT NULL default '0', + `M` tinyint(1) default '0', +) TYPE=MyISAM DEFAULT CHARSET=latin1; +INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0); +UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2; +select * from t1; +-- error 1287 +UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2, P2.N = 2; +delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N; +select * from t1; +-- error 1287 +delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N; +drop table t1; |