summaryrefslogtreecommitdiff
path: root/mysql-test/suite/vcol
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2010-07-02 20:24:39 -0700
committerIgor Babaev <igor@askmonty.org>2010-07-02 20:24:39 -0700
commitb95bd9f5e2040609e2269772ec4ed043d0036cf4 (patch)
tree03d1d64e574100dd934e2d2fb8dcf0925e4200fb /mysql-test/suite/vcol
parent4ee9e66d87cc9ee265b502f803c6884fa3f45940 (diff)
downloadmariadb-git-b95bd9f5e2040609e2269772ec4ed043d0036cf4.tar.gz
Fixed bug #601164.
The functions mysql_delete and mysql_update lacked calls of updated_virtual_fields(). This caused wrong results for some DELETEs/UPDATEs. Added test cases for this bug.
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r--mysql-test/suite/vcol/r/vcol_misc.result32
-rw-r--r--mysql-test/suite/vcol/t/vcol_misc.test21
2 files changed, 53 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result
new file mode 100644
index 00000000000..f312527794a
--- /dev/null
+++ b/mysql-test/suite/vcol/r/vcol_misc.result
@@ -0,0 +1,32 @@
+drop table if exists t1,t2;
+create table t1 (a int, b int, v int as (a+1), index idx(b));
+insert into t1(a, b) values
+(4, 40), (3, 30), (5, 50), (7, 70), (8, 80), (2, 20), (1, 10);
+select * from t1 order by b;
+a b v
+1 10 2
+2 20 3
+3 30 4
+4 40 5
+5 50 6
+7 70 8
+8 80 9
+delete from t1 where v > 6 order by b limit 1;
+select * from t1 order by b;
+a b v
+1 10 2
+2 20 3
+3 30 4
+4 40 5
+5 50 6
+8 80 9
+update t1 set a=v order by b limit 1;
+select * from t1 order by b;
+a b v
+2 10 3
+2 20 3
+3 30 4
+4 40 5
+5 50 6
+8 80 9
+drop table t1;
diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test
new file mode 100644
index 00000000000..a0e654daa57
--- /dev/null
+++ b/mysql-test/suite/vcol/t/vcol_misc.test
@@ -0,0 +1,21 @@
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+#
+# Bug#601164: DELETE/UPDATE with ORDER BY index and LIMIT
+#
+
+create table t1 (a int, b int, v int as (a+1), index idx(b));
+insert into t1(a, b) values
+ (4, 40), (3, 30), (5, 50), (7, 70), (8, 80), (2, 20), (1, 10);
+
+select * from t1 order by b;
+
+delete from t1 where v > 6 order by b limit 1;
+select * from t1 order by b;
+
+update t1 set a=v order by b limit 1;
+select * from t1 order by b;
+
+drop table t1;