diff options
author | unknown <evgen@moonbone.local> | 2007-01-22 15:14:38 +0300 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2007-01-22 15:14:38 +0300 |
commit | df0a08964718cf9ff8189e16fbee75397784596e (patch) | |
tree | 5adfda1a09692651c167ac57baa15ffbcaddd64a /mysql-test/r/insert.result | |
parent | c6d4b94dd452d31f49430321a16690f7bec06d5c (diff) | |
download | mariadb-git-df0a08964718cf9ff8189e16fbee75397784596e.tar.gz |
Bug#25123: ON DUPLICATE KEY clause allows fields not from the insert table.
When inserting into a join-based view the update fields from the ON DUPLICATE
KEY UPDATE wasn't checked to be from the table being inserted into and were
silently ignored.
The new check_view_single_update() function is added to check that
insert/update fields are being from the same single table of the view.
sql/sql_insert.cc:
Bug#25123: ON DUPLICATE KEY clause allows fields not from the insert table.
The new check_view_single_update() function is added to check that
insert/update fields are being from the same single table of the view.
mysql-test/r/insert.result:
Added a test case for bug#25123: ON DUPLICATE KEY clause allows fields not from the insert table.
mysql-test/t/insert.test:
Added a test case for bug#25123: ON DUPLICATE KEY clause allows fields not from the insert table.
Diffstat (limited to 'mysql-test/r/insert.result')
-rw-r--r-- | mysql-test/r/insert.result | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result index 78ef6fbccba..7900e0b7695 100644 --- a/mysql-test/r/insert.result +++ b/mysql-test/r/insert.result @@ -325,3 +325,24 @@ select row_count(); row_count() 1 drop table t1; +create table t1 (f1 int unique, f2 int); +create table t2 (f3 int, f4 int); +create view v1 as select * from t1, t2 where f1= f3; +insert into t1 values (1,11), (2,22); +insert into t2 values (1,12), (2,24); +insert into v1 (f1) values (3) on duplicate key update f3= f3 + 10; +ERROR HY000: Can not modify more than one base table through a join view 'test.v1' +insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10; +select * from t1; +f1 f2 +1 11 +2 22 +3 NULL +insert into v1 (f1) values (3) on duplicate key update f1= f3 + 10; +select * from t1; +f1 f2 +1 11 +2 22 +12 NULL +drop view v1; +drop table t1,t2; |