diff options
author | Monty <monty@mariadb.org> | 2018-06-16 12:03:15 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-06-19 16:23:34 +0300 |
commit | 831df10981b7851871e1f3b8f04079df0cf5da36 (patch) | |
tree | a251a9030404924711ed8c7cdbd5da223e455cc4 /mysql-test/suite/vcol | |
parent | 5ba6cee01255186ea77a69f122d3a15c07f44f6d (diff) | |
download | mariadb-git-831df10981b7851871e1f3b8f04079df0cf5da36.tar.gz |
Add PART_INDIRECT_KEY_FLAG
This is to mark that a field is indirectly part of a key, which simplifes
checking if we need to have this field up to date to evaluate a key.
For example:
CREATE TABLE t1 (a int, b int as (a) virtual,
c int as (b) virtual, index(c))
would mark a and b with PART_INDIRECT_KEY_FLAG.
c is marked with PART_KEY_FLAG as before.
Diffstat (limited to 'mysql-test/suite/vcol')
-rw-r--r-- | mysql-test/suite/vcol/r/index.result | 38 | ||||
-rw-r--r-- | mysql-test/suite/vcol/t/index.test | 25 |
2 files changed, 63 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/r/index.result b/mysql-test/suite/vcol/r/index.result new file mode 100644 index 00000000000..cd4ebc96024 --- /dev/null +++ b/mysql-test/suite/vcol/r/index.result @@ -0,0 +1,38 @@ +CREATE TABLE t1 (a int, b int as (a+1) virtual, c int as (b+1) virtual, index(c)) engine=myisam; +insert into t1 (a) values (1),(2),(3); +update t1 set a=5 where a=3; +delete from t1 where a=1; +select * from t1; +a b c +2 3 4 +5 6 7 +select * from t1 where c=7; +a b c +5 6 7 +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select * from t1; +a b c +2 3 4 +5 6 7 +drop table t1; +CREATE TABLE t1 (a int, b int as (a+1) virtual, c int as (b+1) virtual, index(c)) engine=innodb; +insert into t1 (a) values (1),(2),(3); +update t1 set a=5 where a=3; +delete from t1 where a=1; +select * from t1; +a b c +2 3 4 +5 6 7 +select * from t1 where c=7; +a b c +5 6 7 +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +select * from t1; +a b c +2 3 4 +5 6 7 +drop table t1; diff --git a/mysql-test/suite/vcol/t/index.test b/mysql-test/suite/vcol/t/index.test new file mode 100644 index 00000000000..55d5b68f26b --- /dev/null +++ b/mysql-test/suite/vcol/t/index.test @@ -0,0 +1,25 @@ +--source include/have_innodb.inc + +# +# Test creating table with a key that consists of indirect virtual fields +# + +CREATE TABLE t1 (a int, b int as (a+1) virtual, c int as (b+1) virtual, index(c)) engine=myisam; +insert into t1 (a) values (1),(2),(3); +update t1 set a=5 where a=3; +delete from t1 where a=1; +select * from t1; +select * from t1 where c=7; +check table t1; +select * from t1; +drop table t1; + +CREATE TABLE t1 (a int, b int as (a+1) virtual, c int as (b+1) virtual, index(c)) engine=innodb; +insert into t1 (a) values (1),(2),(3); +update t1 set a=5 where a=3; +delete from t1 where a=1; +select * from t1; +select * from t1 where c=7; +check table t1; +select * from t1; +drop table t1; |