summaryrefslogtreecommitdiff
path: root/mysql-test/suite/vcol
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-09-20 17:47:49 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-09-20 17:47:49 +0300
commitfc3b1a7d2fcc45c05aa19ea35e1d7978b4f90670 (patch)
treed3f4f28b6bb2ffa6e6c4b19e6c03f2e209590171 /mysql-test/suite/vcol
parent4cfef2a5a4157269244923637032c21ff67b0161 (diff)
parent96f06f952d087bd47225cc2784edbb0510fad818 (diff)
downloadmariadb-git-fc3b1a7d2fcc45c05aa19ea35e1d7978b4f90670.tar.gz
Merge 10.2 into bb-10.2-ext
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r--mysql-test/suite/vcol/r/innodb_virtual_fk.result12
-rw-r--r--mysql-test/suite/vcol/r/update.result10
-rw-r--r--mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result23
-rw-r--r--mysql-test/suite/vcol/t/innodb_virtual_fk.test16
-rw-r--r--mysql-test/suite/vcol/t/update.test14
-rw-r--r--mysql-test/suite/vcol/t/vcol_supported_sql_funcs_main.inc10
6 files changed, 79 insertions, 6 deletions
diff --git a/mysql-test/suite/vcol/r/innodb_virtual_fk.result b/mysql-test/suite/vcol/r/innodb_virtual_fk.result
new file mode 100644
index 00000000000..58db12583e2
--- /dev/null
+++ b/mysql-test/suite/vcol/r/innodb_virtual_fk.result
@@ -0,0 +1,12 @@
+set default_storage_engine=innodb;
+create table t1 (id int primary key, id2 int as (id) virtual, key id2 (id2));
+create table t2 (id int key, constraint fk_id foreign key (id) references t1 (id) on delete cascade);
+insert into t1 (id) values (1), (2);
+insert into t2 (id) values (1), (2);
+delete from t1;
+select * from t1;
+id id2
+select * from t2;
+id
+drop table t2;
+drop table t1;
diff --git a/mysql-test/suite/vcol/r/update.result b/mysql-test/suite/vcol/r/update.result
index 95b0093ed71..5c7905cf547 100644
--- a/mysql-test/suite/vcol/r/update.result
+++ b/mysql-test/suite/vcol/r/update.result
@@ -155,3 +155,13 @@ select * from t;
a b c d e
11 11 11 11 11
drop table t, t1, t2;
+create table t (f1 int, f2 int, f3 int as (f1*2) virtual, key(f3,f2));
+insert into t (f1,f2) values (1,1),(2,2);
+create view v as
+select a2.f1, a2.f2, a1.f3
+from t a1, t a2
+where a2.f3 <> 0
+with local check option;
+update v set f3 = 52;
+drop view v;
+drop table t;
diff --git a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result
index 86030a304d4..3fa4f6e1431 100644
--- a/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result
+++ b/mysql-test/suite/vcol/r/vcol_supported_sql_funcs.result
@@ -2911,16 +2911,31 @@ drop table t1;
set sql_warnings = 0;
# TIME_FORMAT()
set sql_warnings = 1;
-create table t1 (a datetime, b varchar(10) as (time_format(a,"%d.%m.%Y")));
+create table t1 (a datetime, b varchar(10) as (time_format(a,"%H.%i.%S")));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` datetime DEFAULT NULL,
- `b` varchar(10) GENERATED ALWAYS AS (time_format(`a`,'%d.%m.%Y')) VIRTUAL
+ `b` varchar(10) GENERATED ALWAYS AS (time_format(`a`,'%H.%i.%S')) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
-insert into t1 values ('2001-01-01 02:02:02',default);
+insert into t1 values ('2001-01-01 02:03:04',default);
select * from t1;
a b
-2001-01-01 02:02:02 01.01.2001
+2001-01-01 02:03:04 02.03.04
+drop table t1;
+set sql_warnings = 0;
+# TIME_FORMAT() STORED
+set sql_warnings = 1;
+create table t1 (a datetime, b varchar(10) as (time_format(a,"%H.%i.%S")) STORED);
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` datetime DEFAULT NULL,
+ `b` varchar(10) GENERATED ALWAYS AS (time_format(`a`,'%H.%i.%S')) STORED
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ('2001-01-01 02:03:04',default);
+select * from t1;
+a b
+2001-01-01 02:03:04 02.03.04
drop table t1;
set sql_warnings = 0;
diff --git a/mysql-test/suite/vcol/t/innodb_virtual_fk.test b/mysql-test/suite/vcol/t/innodb_virtual_fk.test
new file mode 100644
index 00000000000..c364adaa613
--- /dev/null
+++ b/mysql-test/suite/vcol/t/innodb_virtual_fk.test
@@ -0,0 +1,16 @@
+source include/have_innodb.inc;
+set default_storage_engine=innodb;
+
+#
+# MDEV-13708 Crash with indexed virtual columns and FK cascading deletes
+#
+
+create table t1 (id int primary key, id2 int as (id) virtual, key id2 (id2));
+create table t2 (id int key, constraint fk_id foreign key (id) references t1 (id) on delete cascade);
+insert into t1 (id) values (1), (2);
+insert into t2 (id) values (1), (2);
+delete from t1;
+select * from t1;
+select * from t2;
+drop table t2;
+drop table t1;
diff --git a/mysql-test/suite/vcol/t/update.test b/mysql-test/suite/vcol/t/update.test
index 062d9736ed8..1797bdd501e 100644
--- a/mysql-test/suite/vcol/t/update.test
+++ b/mysql-test/suite/vcol/t/update.test
@@ -111,3 +111,17 @@ check table t; select * from t;
update t, t tt set t.b=11, tt.d=11 where t.a=tt.a;
check table t; select * from t;
drop table t, t1, t2;
+
+#
+# MDEV-13623 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' failed in virtual longlong Field_long::val_int
+#
+create table t (f1 int, f2 int, f3 int as (f1*2) virtual, key(f3,f2));
+insert into t (f1,f2) values (1,1),(2,2);
+create view v as
+ select a2.f1, a2.f2, a1.f3
+ from t a1, t a2
+ where a2.f3 <> 0
+ with local check option;
+update v set f3 = 52;
+drop view v;
+drop table t;
diff --git a/mysql-test/suite/vcol/t/vcol_supported_sql_funcs_main.inc b/mysql-test/suite/vcol/t/vcol_supported_sql_funcs_main.inc
index 4a95ea75534..dafc42098dd 100644
--- a/mysql-test/suite/vcol/t/vcol_supported_sql_funcs_main.inc
+++ b/mysql-test/suite/vcol/t/vcol_supported_sql_funcs_main.inc
@@ -1204,8 +1204,14 @@ let $rows = 1;
--source suite/vcol/inc/vcol_supported_sql_funcs.inc
--echo # TIME_FORMAT()
-let $cols = a datetime, b varchar(10) as (time_format(a,"%d.%m.%Y"));
-let $values1 = '2001-01-01 02:02:02',default;
+let $cols = a datetime, b varchar(10) as (time_format(a,"%H.%i.%S"));
+let $values1 = '2001-01-01 02:03:04',default;
+let $rows = 1;
+--source suite/vcol/inc/vcol_supported_sql_funcs.inc
+
+--echo # TIME_FORMAT() STORED
+let $cols = a datetime, b varchar(10) as (time_format(a,"%H.%i.%S")) STORED;
+let $values1 = '2001-01-01 02:03:04',default;
let $rows = 1;
--source suite/vcol/inc/vcol_supported_sql_funcs.inc