summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorsachinsetia1001@gmail.com <sachinsetia1001@gmail.com>2019-03-16 12:34:08 +0530
committersachinsetia1001@gmail.com <sachinsetia1001@gmail.com>2019-03-17 13:45:57 +0530
commit8995f33c0b5ee06eee47535f3c254416d4ab05a3 (patch)
tree7cc0f5631d45238dac723e44ba53f5bb0e8cd495 /mysql-test
parent09b2d37a3227a559aa157fc4a5da5fd6b2011e40 (diff)
downloadmariadb-git-8995f33c0b5ee06eee47535f3c254416d4ab05a3.tar.gz
MDEV-18889 Long unique on virtual fields crashes server
Use table->record[0] for ha_index_read_map so that vfield gets automatically be updated.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/main/long_unique_bugs.result13
-rw-r--r--mysql-test/main/long_unique_bugs.test18
2 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/main/long_unique_bugs.result b/mysql-test/main/long_unique_bugs.result
index d1f04d1e9fa..4ac056d8591 100644
--- a/mysql-test/main/long_unique_bugs.result
+++ b/mysql-test/main/long_unique_bugs.result
@@ -158,3 +158,16 @@ insert into t1 values(1,1);
ERROR 23000: Duplicate entry '1-1' for key 'a'
alter table t1 add column c int;
drop table t1;
+create table t1(a blob , b blob as (a) unique);
+insert into t1 values(1, default);
+insert into t1 values(1, default);
+ERROR 23000: Duplicate entry '1' for key 'b'
+drop table t1;
+create table t1(a blob, b blob, c blob as (left(a, 5000)) virtual, d blob as (left(b, 5000)) persistent, unique(a,b(4000)));
+insert into t1(a,b) values(10,11);
+insert into t1(a,b) values(10,11);
+ERROR 23000: Duplicate entry '10-11' for key 'a'
+insert into t1(a,b) values(2,2);
+insert into t1(a,b) values(2,3);
+insert into t1(a,b) values(3,2);
+drop table t1;
diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test
index b8428e32017..7ae6401ccba 100644
--- a/mysql-test/main/long_unique_bugs.test
+++ b/mysql-test/main/long_unique_bugs.test
@@ -178,3 +178,21 @@ insert into t1 values(1,1);
insert into t1 values(1,1);
alter table t1 add column c int;
drop table t1;
+
+#
+# MDEV-18889 Long unique on virtual fields crashes server
+#
+create table t1(a blob , b blob as (a) unique);
+insert into t1 values(1, default);
+--error ER_DUP_ENTRY
+insert into t1 values(1, default);
+drop table t1;
+
+create table t1(a blob, b blob, c blob as (left(a, 5000)) virtual, d blob as (left(b, 5000)) persistent, unique(a,b(4000)));
+insert into t1(a,b) values(10,11);
+--error ER_DUP_ENTRY
+insert into t1(a,b) values(10,11);
+insert into t1(a,b) values(2,2);
+insert into t1(a,b) values(2,3);
+insert into t1(a,b) values(3,2);
+drop table t1;