summaryrefslogtreecommitdiff
path: root/mysql-test/r/insert.result
diff options
context:
space:
mode:
authorunknown <dlenev@mysql.com>2006-06-16 20:21:25 +0400
committerunknown <dlenev@mysql.com>2006-06-16 20:21:25 +0400
commite08a2b326b143cc5b3dead51f981559aef2c2e95 (patch)
tree49bb7960457e95a5453761b6d5d335e206cc9265 /mysql-test/r/insert.result
parent9b871930a9189cce16b39dc5576f3592a34959ba (diff)
downloadmariadb-git-e08a2b326b143cc5b3dead51f981559aef2c2e95.tar.gz
Fix for bug#13479 "REPLACE activates UPDATE trigger, not the DELETE and
INSERT triggers". In cases when REPLACE was internally executed via update and table had on update (on delete) triggers defined we exposed the fact that such optimization used by callng on update (not calling on delete) triggers. Such behavior contradicts our documentation which describes REPLACE as INSERT with optional DELETE. This fix just disables this optimization for tables with on delete triggers. The optimization is still applied for tables which have on update but have no on delete triggers, we just don't invoke on update triggers in this case and thus don't expose information about optimization to user. Also added test coverage for values returned by ROW_COUNT() function (and thus for values returned by mysql_affected_rows()) for various forms of INSERT. mysql-test/r/insert.result: Added test for values returned by ROW_COUNT() function (and thus for values returned by mysql_affected_rows()) for various forms of INSERT. We didn't have coverage for this before and since this fix touches related code it is better to add it now. mysql-test/r/trigger.result: Adjusted test after fixing bug#13479 "REPLACE activates UPDATE trigger, not the DELETE and INSERT triggers". mysql-test/t/insert.test: Added test for values returned by ROW_COUNT() function (and thus for values returned by mysql_affected_rows()) for various forms of INSERT. We didn't have coverage for this before and since this fix touches related code it is better to add it now. mysql-test/t/trigger.test: Adjusted test after fixing bug#13479 "REPLACE activates UPDATE trigger, not the DELETE and INSERT triggers". sql/sql_insert.cc: write_record(): We should not expose that internally we sometimes execute REPLACE via UPDATE instead of documented INSERT + DELETE pair. So we should not use this optimization for tables with on delete triggers. OTOH it is ok to use it for tables which have on update but have no on delete triggers, we just should not invoke on update triggers in this case.
Diffstat (limited to 'mysql-test/r/insert.result')
-rw-r--r--mysql-test/r/insert.result26
1 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index 00a987c9254..82fad8e912c 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -305,3 +305,29 @@ insert delayed into v1 values (1);
ERROR HY000: 'test.v1' is not BASE TABLE
drop table t1;
drop view v1;
+create table t1 (id int primary key, data int);
+insert into t1 values (1, 1), (2, 2), (3, 3);
+select row_count();
+row_count()
+3
+insert ignore into t1 values (1, 1);
+select row_count();
+row_count()
+0
+replace into t1 values (1, 11);
+select row_count();
+row_count()
+2
+replace into t1 values (4, 4);
+select row_count();
+row_count()
+1
+insert into t1 values (2, 2) on duplicate key update data= data + 10;
+select row_count();
+row_count()
+2
+insert into t1 values (5, 5) on duplicate key update data= data + 10;
+select row_count();
+row_count()
+1
+drop table t1;