diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/suite/vcol/r/vcol_partition_innodb.result | |
parent | Initial commit. (diff) | |
download | mariadb-upstream.tar.xz mariadb-upstream.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/suite/vcol/r/vcol_partition_innodb.result')
-rw-r--r-- | mysql-test/suite/vcol/r/vcol_partition_innodb.result | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/mysql-test/suite/vcol/r/vcol_partition_innodb.result b/mysql-test/suite/vcol/r/vcol_partition_innodb.result new file mode 100644 index 00000000..c25fc7b2 --- /dev/null +++ b/mysql-test/suite/vcol/r/vcol_partition_innodb.result @@ -0,0 +1,89 @@ +SET @@session.default_storage_engine = 'InnoDB'; +drop table if exists t1; +# Case 1. Partitioning by RANGE based on a non-stored virtual column. +CREATE TABLE t1 ( +a DATE NOT NULL, +b int as (year(a)) +) +PARTITION BY RANGE( b ) ( +PARTITION p0 VALUES LESS THAN (2006), +PARTITION p2 VALUES LESS THAN (2008) +); +insert into t1 values ('2006-01-01',default); +insert into t1 values ('2007-01-01',default); +insert into t1 values ('2005-01-01',default); +insert into t1 (a) values ('2007-01-02'); +select * from t1; +a b +2005-01-01 2005 +2006-01-01 2006 +2007-01-01 2007 +2007-01-02 2007 +select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1'; +partition_name table_rows data_length +p0 1 16384 +p2 3 16384 +# Modify the expression of virtual column b +ALTER TABLE t1 modify b int as (year(a)-1); +select * from t1; +a b +2005-01-01 2004 +2006-01-01 2005 +2007-01-01 2006 +2007-01-02 2006 +select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1'; +partition_name table_rows data_length +p0 2 16384 +p2 2 16384 +drop table t1; +# Case 2. Partitioning by LIST based on a stored virtual column. +CREATE TABLE t1 (a int, b int as (a % 3 ) persistent) +PARTITION BY LIST (a+1) +(PARTITION p1 VALUES IN (1), PARTITION p2 VALUES IN (2)); +insert into t1 values (1,default); +select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1'; +partition_name table_rows data_length +p1 0 16384 +p2 1 16384 +select * from t1; +a b +1 1 +select * from t1; +a b +1 1 +drop table t1; +# Case 3. Partitioning by HASH based on a non-stored virtual column. +CREATE TABLE t1 ( +a DATE NOT NULL, +b int as (year(a)) +) +PARTITION BY HASH( b % 3 ) PARTITIONS 3; +insert into t1 values ('2005-01-01',default); +insert into t1 values ('2006-01-01',default); +select * from t1; +a b +2005-01-01 2005 +2006-01-01 2006 +select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1'; +partition_name table_rows data_length +p0 0 16384 +p1 1 16384 +p2 1 16384 +# Modify the expression of virtual column b +ALTER TABLE t1 modify b int as (year(a)-1); +select * from t1; +a b +2005-01-01 2004 +2006-01-01 2005 +select partition_name,table_rows,data_length from information_schema.partitions where table_name = 't1'; +partition_name table_rows data_length +p0 1 16384 +p1 1 16384 +p2 0 16384 +drop table t1; +create table t1 (a int, b datetime as (now())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +create table t1 (a int, b varchar(100) as (user())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +create table t1 (a int, b double as (rand())) partition by hash(b+1) partitions 3; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed |