diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index 63ef07621..5c6a328d9 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -87,7 +87,7 @@ jobs: run: | case ${{ matrix.os }} in debian10_1.0.3) - apt-get install curl lcov bc -y + apt-get update && apt-get install curl lcov bc -y ;; centos7_1.0.3) yum install curl lcov.noarch bc.x86_64 -y diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 44d6f88e0..7451e3970 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -1129,4 +1129,15 @@ static const int errmsg_section_size[] = { 889, 234 }; #define ER_WRITE_SET_EXCEEDS_LIMIT 3231 #define ER_DEPRECATED_TLS_VERSION_SESSION 3232 #define ER_WARN_DEPRECATED_TLS_VERSION 3233 +#define ER_TIANMU_NOT_SUPPORTED_SECONDARY_INDEX 3234 +#define ER_TIANMU_NOT_SUPPORTED_UNIQUE_INDEX 3235 +#define ER_TIANMU_NOT_SUPPORTED_FULLTEXT_INDEX 3236 +#define ER_TIANMU_NOT_SUPPORTED_GEOMETRY 3237 +#define ER_TIANMU_NOT_SUPPORTED_ENUM 3238 +#define ER_TIANMU_NOT_SUPPORTED_SET 3239 +#define ER_TIANMU_NOT_SUPPORTED_TRIGGER 3240 +#define ER_TIANMU_NOT_SUPPORTED_FOREIGN_KEY 3241 +#define ER_TIANMU_NOT_SUPPORTED_PARTITION 3242 +#define ER_TIANMU_NOT_FOUND_INDEX 3243 + #endif diff --git a/mysql-test/suite/tianmu/r/alter_table_v1.result b/mysql-test/suite/tianmu/r/alter_table_v1.result index 8880a821f..24cee6a31 100644 --- a/mysql-test/suite/tianmu/r/alter_table_v1.result +++ b/mysql-test/suite/tianmu/r/alter_table_v1.result @@ -79,57 +79,18 @@ drop database mysqltest; # # ALTER TABLE ... ENABLE/DISABLE KEYS # -create table t1 (n1 int not null, n2 int, n3 int, n4 float, -unique(n1), -key (n1, n2, n3, n4), -key (n2, n3, n4, n1), -key (n3, n4, n1, n2), -key (n4, n1, n2, n3))engine=tianmu; +create table t1 (n1 int not null, n2 int, n3 int, n4 float)engine=tianmu; alter table t1 disable keys; Warnings: Note 1031 Table storage engine for 't1' doesn't have this option show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 n1 1 n1 NULL NULL NULL NULL LSMTREE -t1 1 n1_2 1 n1 NULL NULL NULL NULL LSMTREE -t1 1 n1_2 2 n2 NULL NULL NULL NULL YES LSMTREE -t1 1 n1_2 3 n3 NULL NULL NULL NULL YES LSMTREE -t1 1 n1_2 4 n4 NULL NULL NULL NULL YES LSMTREE -t1 1 n2 1 n2 NULL NULL NULL NULL YES LSMTREE -t1 1 n2 2 n3 NULL NULL NULL NULL YES LSMTREE -t1 1 n2 3 n4 NULL NULL NULL NULL YES LSMTREE -t1 1 n2 4 n1 NULL NULL NULL NULL LSMTREE -t1 1 n3 1 n3 NULL NULL NULL NULL YES LSMTREE -t1 1 n3 2 n4 NULL NULL NULL NULL YES LSMTREE -t1 1 n3 3 n1 NULL NULL NULL NULL LSMTREE -t1 1 n3 4 n2 NULL NULL NULL NULL YES LSMTREE -t1 1 n4 1 n4 NULL NULL NULL NULL YES LSMTREE -t1 1 n4 2 n1 NULL NULL NULL NULL LSMTREE -t1 1 n4 3 n2 NULL NULL NULL NULL YES LSMTREE -t1 1 n4 4 n3 NULL NULL NULL NULL YES LSMTREE insert into t1 values(RAND()*100,RAND()*100,RAND()*10,RAND()*10); alter table t1 enable keys; Warnings: Note 1031 Table storage engine for 't1' doesn't have this option show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 n1 1 n1 NULL NULL NULL NULL LSMTREE -t1 1 n1_2 1 n1 NULL NULL NULL NULL LSMTREE -t1 1 n1_2 2 n2 NULL NULL NULL NULL YES LSMTREE -t1 1 n1_2 3 n3 NULL NULL NULL NULL YES LSMTREE -t1 1 n1_2 4 n4 NULL NULL NULL NULL YES LSMTREE -t1 1 n2 1 n2 NULL NULL NULL NULL YES LSMTREE -t1 1 n2 2 n3 NULL NULL NULL NULL YES LSMTREE -t1 1 n2 3 n4 NULL NULL NULL NULL YES LSMTREE -t1 1 n2 4 n1 NULL NULL NULL NULL LSMTREE -t1 1 n3 1 n3 NULL NULL NULL NULL YES LSMTREE -t1 1 n3 2 n4 NULL NULL NULL NULL YES LSMTREE -t1 1 n3 3 n1 NULL NULL NULL NULL LSMTREE -t1 1 n3 4 n2 NULL NULL NULL NULL YES LSMTREE -t1 1 n4 1 n4 NULL NULL NULL NULL YES LSMTREE -t1 1 n4 2 n1 NULL NULL NULL NULL LSMTREE -t1 1 n4 3 n2 NULL NULL NULL NULL YES LSMTREE -t1 1 n4 4 n3 NULL NULL NULL NULL YES LSMTREE drop table t1; # # Alter table and rename diff --git a/mysql-test/suite/tianmu/r/create_table.result b/mysql-test/suite/tianmu/r/create_table.result index 4e7924262..84832b836 100644 --- a/mysql-test/suite/tianmu/r/create_table.result +++ b/mysql-test/suite/tianmu/r/create_table.result @@ -20,8 +20,8 @@ ERROR 23000: Column 'b' cannot be null create table if not exists t1 (b char(0) not null)ENGINE=tianmu; Warnings: Note 1050 Table 't1' already exists -create table t1 (b char(0) not null, index(b))engine=tianmu; -ERROR 42000: The used storage engine can't index column 'b' +create table t1 (b char(0) not null)engine=tianmu; +ERROR 42S01: Table 't1' already exists drop table t1; create table `a/a` (a int)engine=tianmu; show create table `a/a`; @@ -75,8 +75,6 @@ ERROR 42000: Incorrect table name '' use test; create table t1 (`` int)engine=tianmu; ERROR 42000: Incorrect column name '' -create table t1 (i int, index `` (i))engine=tianmu; -ERROR 42000: Incorrect index name '' create table t1 (i int)engine=tianmu; drop table t1; # @@ -96,83 +94,6 @@ drop table t1; # # Test of primary key with 32 index # -create table t1 (a int not null, b int, primary key(a), -key (b), key (b), key (b), key (b), key (b), key (b), -key (b), key (b), key (b), key (b), key (b), key (b), -key (b), key (b), key (b), key (b), key (b), key (b), -key (b), key (b), key (b), key (b), key (b), key (b), -key (b), key (b), key (b), key (b), key (b), key (b), -key (b))engine=tianmu; -Warnings: -Warning 1831 Duplicate index 'b_2' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_3' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_4' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_5' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_6' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_7' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_8' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_9' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_10' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_11' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_12' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_13' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_14' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_15' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_16' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_17' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_18' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_19' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_20' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_21' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_22' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_23' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_24' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_25' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_26' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_27' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_28' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_29' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_30' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -Warning 1831 Duplicate index 'b_31' defined on the table 'test.t1'. This is deprecated and will be disallowed in a future release. -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `a` int(11) NOT NULL, - `b` int(11) DEFAULT NULL, - PRIMARY KEY (`a`), - KEY `b` (`b`), - KEY `b_2` (`b`), - KEY `b_3` (`b`), - KEY `b_4` (`b`), - KEY `b_5` (`b`), - KEY `b_6` (`b`), - KEY `b_7` (`b`), - KEY `b_8` (`b`), - KEY `b_9` (`b`), - KEY `b_10` (`b`), - KEY `b_11` (`b`), - KEY `b_12` (`b`), - KEY `b_13` (`b`), - KEY `b_14` (`b`), - KEY `b_15` (`b`), - KEY `b_16` (`b`), - KEY `b_17` (`b`), - KEY `b_18` (`b`), - KEY `b_19` (`b`), - KEY `b_20` (`b`), - KEY `b_21` (`b`), - KEY `b_22` (`b`), - KEY `b_23` (`b`), - KEY `b_24` (`b`), - KEY `b_25` (`b`), - KEY `b_26` (`b`), - KEY `b_27` (`b`), - KEY `b_28` (`b`), - KEY `b_29` (`b`), - KEY `b_30` (`b`), - KEY `b_31` (`b`) -) ENGINE=TIANMU DEFAULT CHARSET=latin1 -drop table t1; # # Test default table type # @@ -236,9 +157,9 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp # # Test create with foreign keys # -create table t1 (a int, key(a))engine=tianmu; -create table t2 (b int, foreign key(b) references t1(a), key(b))engine=tianmu; -drop table if exists t1,t2; +drop table if exists t1; +Warnings: +Note 1051 Unknown table 'test.t1' # # Test for create table .. LIKE .. # @@ -339,36 +260,10 @@ create table t1(name varchar(10), age smallint default -1); describe t2; Field Type Null Key Default Extra id int(11) NO NULL +drop table t1,t2; # # 'Naming a key "Primary" causes trouble' # -create table t1 (a int, index `primary` (a))engine=tianmu; -ERROR 42000: Incorrect index name 'primary' -create table t1 (a int, index `PRIMARY` (a))engine=tianmu; -ERROR 42000: Incorrect index name 'PRIMARY' -drop table t1; -create table t1 (`primary` int, index(`primary`))engine=tianmu; -show create table t1; -Table Create Table -t1 CREATE TABLE `t1` ( - `primary` int(11) DEFAULT NULL, - KEY `primary_2` (`primary`) -) ENGINE=TIANMU DEFAULT CHARSET=latin1 -drop table t2; -create table t2 (`PRIMARY` int, index(`PRIMARY`))engine=tianmu; -show create table t2; -Table Create Table -t2 CREATE TABLE `t2` ( - `PRIMARY` int(11) DEFAULT NULL, - KEY `PRIMARY_2` (`PRIMARY`) -) ENGINE=TIANMU DEFAULT CHARSET=latin1 -create table t3 (a int); -alter table t3 add index `primary` (a); -ERROR 42000: Incorrect index name 'primary' -alter table t3 add index `PRIMARY` (a); -ERROR 42000: Incorrect index name 'PRIMARY' -create table t4 (`primary` int)engine=tianmu; -drop table t1,t2,t3,t4; # #Can't use 'DEFAULT FALSE' for column of type bool # @@ -490,7 +385,7 @@ drop tables t1,t2; # # Creating a base table in presence of an updatable view. # -create table t2 (a int unique); +create table t2 (a int primary key); create view t1 as select a from t2; insert into t1 (a) values (1); create table t1 (a int); diff --git a/mysql-test/suite/tianmu/r/delete.result b/mysql-test/suite/tianmu/r/delete.result index 162248e3b..d4d74680f 100644 --- a/mysql-test/suite/tianmu/r/delete.result +++ b/mysql-test/suite/tianmu/r/delete.result @@ -254,7 +254,7 @@ DELETE t2 FROM t1 JOIN t2 WHERE t1.a = 10; ERROR HY000: You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column. SET SESSION sql_safe_updates=default; DROP TABLE t1, t2; -create table t1 (a int, b int, unique key (a), key (b))ENGINE=TIANMU; +create table t1 (a int, b int)ENGINE=TIANMU; insert into t1 values (3, 3), (7, 7); delete from t1 where a = 3; check table t1; diff --git a/mysql-test/suite/tianmu/r/insert.result b/mysql-test/suite/tianmu/r/insert.result index bbf25dfe7..370c46e1c 100644 --- a/mysql-test/suite/tianmu/r/insert.result +++ b/mysql-test/suite/tianmu/r/insert.result @@ -65,8 +65,7 @@ drop table t1; # # Test of duplicate key values with packed keys # -create table t1 (id int not null auto_increment primary key, username varchar(32) not null, -unique (username)); +create table t1 (id int not null auto_increment primary key, username varchar(32) not null); insert into t1 values (0,"mysql"); insert into t1 values (0,"mysql ab"); insert into t1 values (0,"mysql a"); @@ -248,7 +247,7 @@ drop table t1; # create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); -create table t3(id3 int not null, t char(12), index(id3)); +create table t3(id3 int not null, t char(12)); select count(*) from t2; count(*) 500 @@ -308,7 +307,7 @@ drop table t1; # # ON DUPLICATE KEY clause allows fields not from the insert table # -create table t1 (f1 int unique, f2 int); +create table t1 (f1 int primary key, f2 int); create table t2 (f3 int, f4 int); create view v1 as select * from t1, t2 where f1= f3; insert into t1 values (1,11), (2,22); diff --git a/mysql-test/suite/tianmu/r/insert_select.result b/mysql-test/suite/tianmu/r/insert_select.result index 72ddd4774..990f19828 100644 --- a/mysql-test/suite/tianmu/r/insert_select.result +++ b/mysql-test/suite/tianmu/r/insert_select.result @@ -547,8 +547,7 @@ f2 varchar(100) NOT NULL default '' CREATE TABLE t2 ( f1 varchar(10) NOT NULL default '', f2 char(3) NOT NULL default '', -PRIMARY KEY (`f1`), -KEY `k1` (`f2`, `f1`) +PRIMARY KEY (`f1`) ); INSERT INTO t1 values(NULL, ''); INSERT INTO `t2` VALUES ('486878','WDT'),('486910','WDT'); diff --git a/mysql-test/suite/tianmu/r/issue1054.result b/mysql-test/suite/tianmu/r/issue1054.result index a6f11762e..441a7afaa 100644 --- a/mysql-test/suite/tianmu/r/issue1054.result +++ b/mysql-test/suite/tianmu/r/issue1054.result @@ -83,7 +83,7 @@ CREATE TABLE `t_issue1054` ( `into` blob COMMENT 'blob', `set` text COMMENT 'text', `show` longblob COMMENT 'longblob', -UNIQUE (`usage`) +primary key (`usage`) ) engine=tianmu; insert into t_issue1054 values(100,100,100,100,100,5.2,10.88,100.08300,'2016-02-25','2016-02-25 10:20:01', diff --git a/mysql-test/suite/tianmu/r/issue1169.result b/mysql-test/suite/tianmu/r/issue1169.result index 44f12c5fd..fb741cdbe 100644 --- a/mysql-test/suite/tianmu/r/issue1169.result +++ b/mysql-test/suite/tianmu/r/issue1169.result @@ -29,11 +29,7 @@ CREATE TABLE `customer_branch_account` ( `change_sign` varchar(50) DEFAULT NULL COMMENT '', `rebate_item` varchar(30) DEFAULT NULL COMMENT '', `rebate_subitem` varchar(30) DEFAULT NULL COMMENT '', -PRIMARY KEY (`id`) USING BTREE, -UNIQUE KEY `union` (`branch_org_code`,`customer_code`,`agency_org_code`,`draw_category`,`transfer_course`,`type`,`dr`) -USING BTREE COMMENT '', -KEY `idx_union` (`agency_org_code`,`customer_code`,`draw_category`,`transfer_course`,`dr`) -USING BTREE COMMENT '' +PRIMARY KEY (`id`) USING BTREE ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='关系表'; INSERT INTO `customer_branch_account` VALUES (1294275002876649148,x'E6998BE89299E58886E585ACE58FB8','RGB03-210597',x'E9A298E79BAE36E38090E5BCA0E694B9E78EB2E4B8ADE58FB0E5AD98E9878FE8A1A5E58585E5AEA2E688B7E38091','2120954','RGB03-210608',x'E995BFE6B2BB','3000252',x'E9A298E79BAE36E38090E5BCA0E694B9E78EB2E4B8ADE58FB0E5AD98E9878FE8A1A5E58585E5AEA2E688B7E38091E997A8E5BA97E4B880','PL01',0,1471413534935126016,NULL,-1,'','2021-12-16 17:34:59','','2021-12-16 17:34:59',-1,0,0,NULL,NULL,NULL); select * from customer_branch_account into outfile "MYSQLTEST_VARDIR/tmp/issue1169_out_1.txt" fields terminated by ',' enclosed by '"' lines terminated by '\n' ; diff --git a/mysql-test/suite/tianmu/r/issue1185.result b/mysql-test/suite/tianmu/r/issue1185.result new file mode 100644 index 000000000..4446dcb9f --- /dev/null +++ b/mysql-test/suite/tianmu/r/issue1185.result @@ -0,0 +1,306 @@ +DROP DATABASE IF EXISTS issue1185_test; +CREATE DATABASE issue1185_test; +USE issue1185_test; +# +# Secondary INDEX +# +CREATE TABLE tb_stu_info (id int(11) NOT NULL, height int(11) DEFAULT NULL,KEY height (height)) ENGINE=TIANMU; +ERROR HY000: Tianmu engine does not support secondary index. +CREATE TABLE tb_stu_info (id int(11) NOT NULL, height int(11) DEFAULT NULL,INDEX height (height)) ENGINE=TIANMU; +ERROR HY000: Tianmu engine does not support secondary index. +CREATE TABLE tb_stu_info (id int, col_name varchar(10)) ENGINE=TIANMU; +CREATE INDEX index_name ON tb_stu_info(column_name); +ERROR HY000: Tianmu engine does not support secondary index. +ALTER TABLE tb_stu_info add INDEX index_name (col_name) ; +ERROR HY000: Tianmu engine does not support secondary index. +ALTER TABLE tb_stu_info add KEY index_name (col_name) ; +ERROR HY000: Tianmu engine does not support secondary index. +ALTER TABLE tb_stu_info DROP INDEX indx_name; +ERROR HY000: Tianmu engine does not find the index. +ALTER TABLE tb_stu_info DROP KEY indx_name; +ERROR HY000: Tianmu engine does not find the index. +ALTER TABLE tb_stu_info RENAME INDEX old_index_name TO new_index_name; +ERROR HY000: Tianmu engine does not find the index. +ALTER TABLE tb_stu_info RENAME KEY old_index_name TO new_index_name; +ERROR HY000: Tianmu engine does not find the index. +# +# UNIQUE INDEX +# +CREATE TABLE tb_stu_info_2 (id int(11) NOT NULL, height int(11) DEFAULT NULL,UNIQUE KEY height (height)) ENGINE=TIANMU; +ERROR HY000: Tianmu engine does not support unique index. +CREATE TABLE tb_stu_info_2 (id int(11) NOT NULL, height int(11) DEFAULT NULL,UNIQUE INDEX height (height)) ENGINE=TIANMU; +ERROR HY000: Tianmu engine does not support unique index. +CREATE TABLE tb_stu_info_2 (id int(11) NOT NULL, height int(11) DEFAULT NULL) ENGINE=TIANMU; +ALTER TABLE tb_stu_info_2 ADD CONSTRAINT constraint_name UNIQUE KEY(height); +ERROR HY000: Tianmu engine does not support unique index. +ALTER TABLE tb_stu_info_2 ADD CONSTRAINT constraint_name UNIQUE INDEX(height); +ERROR HY000: Tianmu engine does not support unique index. +CREATE UNIQUE INDEX index_name ON tb_stu_info_2(height); +ERROR HY000: Tianmu engine does not support unique index. +ALTER TABLE tb_stu_info_2 DROP INDEX c; +ERROR HY000: Tianmu engine does not find the index. +ALTER TABLE tb_stu_info_2 DROP KEY c; +ERROR HY000: Tianmu engine does not find the index. +ALTER TABLE tb_stu_info_2 RENAME INDEX old_index_name TO new_index_name; +ERROR HY000: Tianmu engine does not find the index. +ALTER TABLE tb_stu_info_2 RENAME KEY old_index_name TO new_index_name; +ERROR HY000: Tianmu engine does not find the index. +# +# FULL INDEX +# +CREATE TABLE tb_posts (id int(4) NOT NULL AUTO_INCREMENT, +title varchar(255) NOT NULL, +post_content text, +PRIMARY KEY (id), +FULLTEXT KEY post_content (post_content) +)ENGINE=TIANMU; +ERROR HY000: Tianmu engine does not support fulltext index. +CREATE TABLE tb_posts (id int(4) NOT NULL AUTO_INCREMENT, +title varchar(255) NOT NULL, +post_content text, +PRIMARY KEY (id) +)ENGINE=TIANMU; +ALTER TABLE tb_posts ADD FULLTEXT INDEX index_name (post_content); +ERROR HY000: Tianmu engine does not support fulltext index. +CREATE FULLTEXT INDEX index_name ON tb_posts (post_content); +ERROR HY000: Tianmu engine does not support fulltext index. +ALTER TABLE tb_posts DROP INDEX index_name; +ERROR HY000: Tianmu engine does not find the index. +ALTER TABLE tb_posts DROP KEY index_name; +ERROR HY000: Tianmu engine does not find the index. +DROP INDEX index_name ON tb_posts; +ERROR HY000: Tianmu engine does not find the index. +# +# SPATIAL INDEX +# +CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)); +ERROR HY000: Tianmu engine does not support gemoetry. +# +# FOREIGN KEY +# +CREATE TABLE customer (id int primary key) ENGINE=TIANMU; +CREATE TABLE product_order ( +no INT NOT NULL , +customer_id INT NOT NULL primary key, +FOREIGN KEY (customer_id) +REFERENCES customer1(id)) ENGINE=TIANMU; +ERROR HY000: Tianmu engine does not support foreign key. +CREATE TABLE product_order ( +no INT NOT NULL , +customer_id INT NOT NULL primary key) ENGINE=TIANMU; +ALTER TABLE product_order ADD CONSTRAINT fk_custome_key FOREIGN KEY(customer_id) REFERENCES customer(id); +ERROR HY000: Tianmu engine does not support foreign key. +ALTER TABLE product_order DROP FOREIGN KEY customer_id; +ERROR HY000: Tianmu engine does not support foreign key. +# +# PARTITION +# +CREATE TABLE t1 (id INT, amount DECIMAL(7,2), tr_date DATE) ENGINE=TIANMU PARTITION BY HASH( MONTH(tr_date)) PARTITIONS 6; +ERROR HY000: Tianmu engine does not support partition. +CREATE TABLE t1 (id INT, amount DECIMAL(7,2), tr_date DATE) ENGINE=TIANMU; +ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN (2002)); +ERROR HY000: Tianmu engine does not support partition. +ALTER TABLE t1 DROP PARTITION p0, p1; +ERROR HY000: Tianmu engine does not support partition. +# +# GEOMETRY, ENUM, SET +# +CREATE TABLE geom (g GEOMETRY NOT NULL) engine=tianmu; +ERROR HY000: Tianmu engine does not support gemoetry. +CREATE TABLE my_enum(gender enum('male', 'female', 'secret'))engine=tianmu; +ERROR HY000: Tianmu engine does not support enum data type. +CREATE TABLE myset_test(Myset SET('Java','Python','C++','PHP'))engine=tianmu; +ERROR HY000: Tianmu engine does not support set data type. +# +# TRIGGER +# +CREATE TABLE employees( +id INT auto_increment PRIMARY KEY, +employeeNumber INT NOT NULL, +lastname VARCHAR(50) NOT NULL, +changedat DATETIME DEFAULT NULL, +action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; +CREATE TABLE employees_audit( +id INT auto_increment PRIMARY KEY, +employeeNumber INT NOT NULL, +lastname VARCHAR(50) NOT NULL, +changedat DATETIME DEFAULT NULL, +action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; +CREATE TABLE employees_audit2( +id INT auto_increment PRIMARY KEY, +employeeNumber INT NOT NULL, +lastname VARCHAR(50) NOT NULL, +changedat DATETIME DEFAULT NULL, +action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; +CREATE TRIGGER before_employee_update +BEFORE UPDATE ON employees +FOR EACH ROW +BEGIN +INSERT INTO employees_audit +SET action = 'update', +employeeNumber = OLD.employeeNumber, +lastname = OLD.lastname, +new_lastname = NEW.lastname, +changedat = NOW( ); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER after_employee_update +after UPDATE ON employees +FOR EACH ROW +BEGIN +INSERT INTO employees_audit2 +SET action = 'update', +employeeNumber = OLD.employeeNumber, +lastname = OLD.firstName, +new_lastname = NEW.firstName, +changedat = NOW( ); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_employee_insert +BEFORE INSERT ON employees +FOR EACH ROW +BEGIN +INSERT INTO employees_audit +SET action = 'insert', +employeeNumber = NEW.employeeNumber, +lastname = NEW.lastname, +new_lastname = NEW.lastname, +changedat = NOW( ); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER AFTER_employee_insert +AFTER INSERT ON employees +FOR EACH ROW +BEGIN +INSERT INTO employees_audit2 +SET action = 'insert', +employeeNumber = NEW.employeeNumber, +lastname = NEW.lastname, +new_lastname = NEW.lastname, +changedat = NOW( ); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER BEFORE_employee_delete +BEFORE DELETE ON employees +FOR EACH ROW +BEGIN +INSERT INTO employees_audit +SET action = 'delete', +employeeNumber = OLD.employeeNumber, +lastname = OLD.lastname, +new_lastname = OLD.lastname, +changedat = NOW( ); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER after_employee_delete +after DELETE ON employees +FOR EACH ROW +BEGIN +INSERT INTO employees_audit2 +SET action = 'delete', +employeeNumber = OLD.employeeNumber, +lastname = OLD.lastname, +new_lastname = OLD.lastname, +changedat = NOW( ); +END | +ERROR HY000: Tianmu engine does not support trigger. +# +# TRIGGER BEFORE PRECEDES/FOLLOWS +# +CREATE TABLE price_logs ( +id INT(11) NOT NULL, +product_code VARCHAR(15) NOT NULL, +price DOUBLE NOT NULL, +updated_at TIMESTAMP NOT NULL +) ENGINE=tianmu; +CREATE TABLE user_change_logs ( +id int(11) NOT NULL , +product_code varchar(15) DEFAULT NULL, +updated_at timestamp NOT NULL, +updated_by varchar(30) NOT NULL +) ENGINE=tianmu; +CREATE TABLE `products` ( +`productCode` varchar(15) NOT NULL DEFAULT '' COMMENT '', +`productName` varchar(70) NOT NULL COMMENT '', +`productLine` varchar(50) NOT NULL COMMENT '', +`productScale` varchar(10) NOT NULL, +`productVendor` varchar(50) NOT NULL, +`productDescription` text NOT NULL, +`quantityInStock` smallint(6) NOT NULL COMMENT '', +`buyPrice` decimal(10,2) NOT NULL COMMENT '', +`MSRP` decimal(10,2) NOT NULL COMMENT '', +PRIMARY KEY (`productCode`) +) ENGINE=TIANMU DEFAULT CHARSET=utf8; +CREATE TRIGGER before_products_update +BEFORE UPDATE ON products +FOR EACH ROW +BEGIN +INSERT INTO price_logs ( product_code, price ) +VALUES(old.productCode, old.msrp); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_products_update_2 +BEFORE UPDATE ON products +FOR EACH ROW FOLLOWS before_products_update +BEGIN +INSERT INTO user_change_logs ( product_code, updated_by ) +VALUES(old.productCode, USER ()); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_products_update_2 +BEFORE UPDATE ON products +FOR EACH ROW PRECEDES before_products_update +BEGIN +INSERT INTO user_change_logs ( product_code, updated_by ) +VALUES(old.productCode, USER ()); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_products_insert_2 +BEFORE INSERT ON products +FOR EACH ROW FOLLOWS before_products_insert +BEGIN +INSERT INTO user_change_logs ( product_code, updated_by ) +VALUES(new.productCode, USER ()); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_products_insert +BEFORE INSERT ON products +FOR EACH ROW +BEGIN +INSERT INTO price_logs ( product_code, price ) +VALUES(new.productCode, new.msrp); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_products_insert_2 +BEFORE INSERT ON products +FOR EACH ROW PRECEDES before_products_insert +BEGIN +INSERT INTO user_change_logs ( product_code, updated_by ) +VALUES(new.productCode, USER ()); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_products_delete +BEFORE DELETE ON products +FOR EACH ROW +BEGIN +INSERT INTO price_logs ( product_code, price ) +VALUES(old.productCode, old.msrp); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_products_delete_2 +BEFORE delete ON products +FOR EACH ROW FOLLOWS before_products_delete +BEGIN +INSERT INTO user_change_logs ( product_code, updated_by ) +VALUES(old.productCode, USER ()); +END | +ERROR HY000: Tianmu engine does not support trigger. +CREATE TRIGGER before_products_delete_2 +BEFORE delete ON products +FOR EACH ROW PRECEDES before_products_delete +BEGIN +INSERT INTO user_change_logs ( product_code, updated_by ) +VALUES(old.productCode, USER ()); +END | +ERROR HY000: Tianmu engine does not support trigger. +DROP DATABASE issue1185_test; diff --git a/mysql-test/suite/tianmu/r/issue270.result b/mysql-test/suite/tianmu/r/issue270.result index dbfd129ce..8fdc679a8 100644 --- a/mysql-test/suite/tianmu/r/issue270.result +++ b/mysql-test/suite/tianmu/r/issue270.result @@ -7,18 +7,18 @@ USE issue270_test; DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t3; -CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c))engine=tianmu; +CREATE TABLE t1(a int, b int, c int)engine=tianmu; insert into t1 values (1,0,0),(2,0,0); CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a))engine=tianmu; insert into t2 values (1,'',''), (2,'',''); -CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b))engine=tianmu; +CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b))engine=tianmu; insert into t3 values (1,1),(1,2); explain select straight_join DISTINCT t2.a,t2.b, t1.c from t1, t3, t2 where (t1.c=t2.a or (t1.c=t3.a and t2.a=t3.b)) and t1.b=556476786 and t2.b like '%%' order by t2.b limit 0,1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 NULL ALL b,c NULL NULL NULL 2 100.00 Using where with pushed condition (`issue270_test`.`t1`.`b` = 556476786)(t0) Pckrows: 1, susp. 0 (1 empty 0 full). Conditions: 1; Using temporary; Using filesort -1 SIMPLE t3 NULL ALL PRIMARY,a,b NULL NULL NULL 2 100.00 Using join buffer (Block Nested Loop) +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 2 50.00 Using where with pushed condition (`issue270_test`.`t1`.`b` = 556476786)(t0) Pckrows: 1, susp. 0 (1 empty 0 full). Conditions: 1; Using temporary; Using filesort +1 SIMPLE t3 NULL ALL PRIMARY NULL NULL NULL 2 100.00 Using join buffer (Block Nested Loop) 1 SIMPLE t2 NULL ALL PRIMARY NULL NULL NULL 2 50.00 Range checked for each record (index map: 0x1) drop table t1,t2,t3; DROP DATABASE issue270_test; diff --git a/mysql-test/suite/tianmu/r/issue281.result b/mysql-test/suite/tianmu/r/issue281.result index 519b3adce..1dad665f4 100644 --- a/mysql-test/suite/tianmu/r/issue281.result +++ b/mysql-test/suite/tianmu/r/issue281.result @@ -2,7 +2,7 @@ DROP DATABASE IF EXISTS issue281_test; CREATE DATABASE issue281_test; USE issue281_test; DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 INT UNIQUE) ENGINE=TIANMU; +CREATE TABLE t1 (f1 INT) ENGINE=TIANMU; INSERT INTO t1 VALUES(1),(2),(NULL),(NULL); SELECT * FROM t1 WHERE f1 IS NULL; f1 diff --git a/mysql-test/suite/tianmu/r/issue301.result b/mysql-test/suite/tianmu/r/issue301.result index d5ddd8a32..526a74b0d 100644 --- a/mysql-test/suite/tianmu/r/issue301.result +++ b/mysql-test/suite/tianmu/r/issue301.result @@ -169,28 +169,21 @@ drop table t1,t2; SET NAMES utf8; CREATE TABLE diaries ( created_at datetime, -title varchar(256), -KEY created_at_key(created_at) +title varchar(256) ) engine=tianmu DEFAULT CHARSET=utf8; INSERT INTO diaries VALUES ("1000-01-01 00:00:00", "The start"); INSERT INTO diaries VALUES ("2012-10-25 16:18:29", "Today is shiny day."); INSERT INTO diaries VALUES ("9999-12-31 23:59:59", "The end"); SELECT * -FROM diaries FORCE INDEX(created_at_key) +FROM diaries WHERE created_at = created_at or created_at = "2012-10-25 16:18:29"; created_at title 1000-01-01 00:00:00 The start 2012-10-25 16:18:29 Today is shiny day. 9999-12-31 23:59:59 The end -SELECT * -FROM diaries FORCE INDEX(created_at_key) -WHERE created_at = created_at and created_at = "2012-10-25 16:18:29"; -created_at title -2012-10-25 16:18:29 Today is shiny day. DROP TABLE diaries; CREATE TABLE tags ( -name VARCHAR(16) NOT NULL, -KEY index_name (name) +name VARCHAR(16) NOT NULL )engine=tianmu; INSERT INTO tags VALUES ('mroonga'); INSERT INTO tags VALUES ('mysql'); diff --git a/mysql-test/suite/tianmu/r/issue790.result b/mysql-test/suite/tianmu/r/issue790.result index e87a41e97..7224c7e04 100644 --- a/mysql-test/suite/tianmu/r/issue790.result +++ b/mysql-test/suite/tianmu/r/issue790.result @@ -30,9 +30,7 @@ CREATE TABLE `account` ( `version` int(11) DEFAULT '0' COMMENT '', `account_balance` decimal(15,2) DEFAULT '0.00' COMMENT '', `order_froze_amount` decimal(15,2) DEFAULT NULL COMMENT '', -PRIMARY KEY (`id`), -UNIQUE KEY `account_acc_id_uindex` (`acc_id`), -KEY `index_name` (`acc_id`) +PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COMMENT='账户'; CREATE TABLE `account_statement` ( `id` bigint(20) NOT NULL COMMENT '', @@ -58,9 +56,7 @@ CREATE TABLE `account_statement` ( `after_froze_amount` decimal(15,2) DEFAULT '0.00' COMMENT '', `before_froze_order_amount` decimal(15,2) DEFAULT NULL COMMENT '', `after_froze_order_amount` decimal(15,2) DEFAULT NULL COMMENT '', -PRIMARY KEY (`id`), -KEY `index_business_no` (`business_no`), -KEY `index_name` (`acc_id`) +PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COMMENT='账户流水'; CREATE TABLE `customer_branch_account` ( `id` bigint(20) NOT NULL AUTO_INCREMENT, @@ -87,11 +83,7 @@ CREATE TABLE `customer_branch_account` ( `change_sign` varchar(50) DEFAULT NULL COMMENT '', `rebate_item` varchar(30) DEFAULT NULL COMMENT '', `rebate_subitem` varchar(30) DEFAULT NULL COMMENT '', -PRIMARY KEY (`id`) USING BTREE, -UNIQUE KEY `union` (`branch_org_code`,`customer_code`,`agency_org_code`,`draw_category`,`transfer_course`,`type`,`dr`) -USING BTREE COMMENT '', -KEY `idx_union` (`agency_org_code`,`customer_code`,`draw_category`,`transfer_course`,`dr`) -USING BTREE COMMENT '' +PRIMARY KEY (`id`) USING BTREE ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='关系表'; LOAD DATA local INFILE 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue790_customer_branch_account.txt' into TABLE customer_branch_account fields terminated by ',' enclosed by '"' lines terminated by '\n' ; LOAD DATA local INFILE 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue790_account.txt' into TABLE account fields terminated by ',' enclosed by '"' lines terminated by '\n' ; diff --git a/mysql-test/suite/tianmu/r/issue880.result b/mysql-test/suite/tianmu/r/issue880.result index ae163c463..e88a7d6e1 100644 --- a/mysql-test/suite/tianmu/r/issue880.result +++ b/mysql-test/suite/tianmu/r/issue880.result @@ -33,11 +33,7 @@ CREATE TABLE `issue880_t1` ( `operator` varchar(50) DEFAULT NULL COMMENT '操作人; Size[MB]: 0.1; Ratio: 0.02', `operator_id` int(11) DEFAULT NULL COMMENT '操作人id; Size[MB]: 0.1; Ratio: 1.78', `remark` varchar(50) DEFAULT NULL COMMENT '备注; Size[MB]: 0.1; Ratio: 0.02', -PRIMARY KEY (`id`), -UNIQUE KEY `company_account_change_id` (`id`), -KEY `company_change_company_id` (`COMPANY_ID`), -KEY `period_pay_id_index` (`period_pay_id`), -KEY `period_account_id_index` (`period_account_id`) +PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED; CREATE TABLE `issue880_t2` ( `id` int(10) NOT NULL COMMENT 'Size[MB]: 0.1; Ratio: 2.00\0 ', @@ -84,12 +80,7 @@ CREATE TABLE `issue880_t2` ( `subscribe_number` varchar(5000) DEFAULT NULL COMMENT '订阅编号; Size[MB]: 0.1; Ratio: 0.04', `settlement_status` smallint(1) DEFAULT '1' COMMENT '是否需要结算0不需要,1需要; Size[MB]: 0.1; Ratio: 1.60', `company_type` smallint(1) DEFAULT '1' COMMENT '公司类型(1:运营商,2:合作伙伴); Size[MB]: 0.1; Ratio: 2.12', -PRIMARY KEY (`id`), -UNIQUE KEY `period_account_id` (`id`), -KEY `period_account_company_id` (`company_id`), -KEY `index_pay_type` (`pay_type`), -KEY `index_pay_status` (`pay_status`), -KEY `index_type_status` (`pay_type`,`pay_status`) +PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED; CREATE TABLE `issue880_t3` ( `id` int(10) NOT NULL COMMENT 'Size[MB]: 0.1; Ratio: 2.00\0 ', @@ -110,11 +101,7 @@ CREATE TABLE `issue880_t3` ( `account_number` varchar(20) DEFAULT NULL COMMENT '交易银行账户; Size[MB]: 0.1; Ratio: 0.04', `pay_flag` smallint(1) DEFAULT '0' COMMENT '是否需要支付,0需要,1不需要; Size[MB]: 0.1; Ratio: 0.24', `union_order_flag` smallint(1) DEFAULT '0' COMMENT '是否合成订单0不是,1是; Size[MB]: 0.1; Ratio: 2.12', -PRIMARY KEY (`id`), -UNIQUE KEY `pay_id` (`id`), -UNIQUE KEY `pay_order_no` (`order_no`), -KEY `pay_status_index` (`pay_status`), -KEY `idx_pay_status_feetype` (`pay_status`,`fee_type`) +PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED; LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue880_t1.txt' INTO TABLE issue880_t1; LOAD DATA LOCAL INFILE 'MYSQL_TEST_DIR/suite/tianmu/std_data/issue880_t3.txt' INTO TABLE issue880_t3; diff --git a/mysql-test/suite/tianmu/r/issue964.result b/mysql-test/suite/tianmu/r/issue964.result index 6505e9a49..6bfed7042 100644 --- a/mysql-test/suite/tianmu/r/issue964.result +++ b/mysql-test/suite/tianmu/r/issue964.result @@ -4,13 +4,13 @@ USE issue964_test; DROP TABLE IF EXISTS t1,t2; CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, -`name` varchar(20) DEFAULT NULL, -KEY `idx_n` (`name`) +`name` varchar(20), +PRIMARY KEY `idx_n` (`name`) ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; CREATE TABLE `t2` ( `id` int(11) DEFAULT NULL, -`name` varchar(20) DEFAULT NULL, -KEY `idx_n` (`name`) +`name` varchar(20), +PRIMARY KEY `idx_n` (`name`) )DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; insert into t1 values(1,'abc'); insert into t1 values(2,'def'); diff --git a/mysql-test/suite/tianmu/r/select.result b/mysql-test/suite/tianmu/r/select.result index 30607eb68..f45076966 100644 --- a/mysql-test/suite/tianmu/r/select.result +++ b/mysql-test/suite/tianmu/r/select.result @@ -33,8 +33,6 @@ fld3 char(30) DEFAULT '' NOT NULL, fld4 char(35) DEFAULT '' NOT NULL, fld5 char(35) DEFAULT '' NOT NULL, fld6 char(4) DEFAULT '' NOT NULL, -UNIQUE fld1 (fld1), -KEY fld3 (fld3), PRIMARY KEY (auto) )engine=tianmu; # @@ -157,26 +155,10 @@ fld3 select t2.fld3 from t2 where fld3 = 'honeysuckle'; fld3 honeysuckle -select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -fld3 -honeysuckle -select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -fld3 -honeysuckle -select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -fld3 -honeysuckle -select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; -fld3 -honeysuckle # # NOTE NOTE NOTE # The next should give an error # -select fld3 from t2 ignore index (fld3,not_used); -ERROR 42000: Key 'not_used' doesn't exist in table 't2' -select fld3 from t2 use index (not_used); -ERROR 42000: Key 'not_used' doesn't exist in table 't2' # # Test sorting with a used key (there is no need for sorting) # @@ -485,9 +467,7 @@ period int not null, name char(32) not null, companynr int not null, price double(11,0), -price2 double(11,0), -key (period), -key (name) +price2 double(11,0) )engine=tianmu; INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1001,"Iranizes",37,5987435,234724); INSERT INTO t3 (period,name,companynr,price,price2) VALUES (1002,"violinist",37,28357832,8723648); @@ -504,9 +484,7 @@ period int not null, name char(32) not null, companynr int not null, price double(11,0), -price2 double(11,0), -key (period), -key (name) +price2 double(11,0) )engine=tianmu; #Reverse insert data insert into t3_1 select * from t3; diff --git a/mysql-test/suite/tianmu/r/update_v1.result b/mysql-test/suite/tianmu/r/update_v1.result index 80eca11a9..2b2db54bf 100644 --- a/mysql-test/suite/tianmu/r/update_v1.result +++ b/mysql-test/suite/tianmu/r/update_v1.result @@ -97,12 +97,7 @@ bcc varchar(255) NOT NULL default '', body text NOT NULL, comment text, header text, -PRIMARY KEY (lfdnr), -KEY k1 (timestamp), -KEY k2 (type), -KEY k3 (parent), -KEY k4 (assignment), -KEY ticket (ticket) +PRIMARY KEY (lfdnr) ) ENGINE=tianmu; INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','',''); update t1 set status=1 where type='Open'; @@ -116,9 +111,8 @@ drop table t1; CREATE TABLE t1 ( `id_param` smallint(3) NOT NULL default '0', `nom_option` char(40) NOT NULL default '', -`valid` tinyint(1) NOT NULL default '0', -KEY `id_param` (`id_param`,`nom_option`) -) ENGINE=tianmu; +`valid` tinyint(1) NOT NULL default '0' + ) ENGINE=tianmu; INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1); UPDATE t1 SET nom_option='test' WHERE id_param=185 AND nom_option='600x1200' AND valid=1 LIMIT 1; select * from t1; @@ -153,7 +147,7 @@ drop table t1; # # a problem with update and partial key part # -create table t1 (a int, b char(255), key(a, b(20))); +create table t1 (a int, b char(255)); insert into t1 values (0, '1'); update t1 set b = b + 1 where a = 0; select * from t1; @@ -215,8 +209,7 @@ drop table t1; CREATE TABLE t1 ( a INT(11), quux decimal(17, 10), -UNIQUE KEY bar (a), -KEY quux (quux) +PRIMARY KEY bar (a) )engine=tianmu; INSERT INTO t1 ( a, quux ) @@ -251,8 +244,7 @@ DROP TABLE t1; CREATE TABLE t1( id INTEGER NOT NULL AUTO_INCREMENT, token VARCHAR(255) DEFAULT NULL, -PRIMARY KEY (id), -KEY token (token) +PRIMARY KEY (id) )engine=tianmu; INSERT INTO t1 VALUES (1, "abc"), (2, "def"); SELECT * FROM t1; diff --git a/mysql-test/suite/tianmu/t/alter_table_v1.test b/mysql-test/suite/tianmu/t/alter_table_v1.test index ced52f3d8..dcff7322b 100644 --- a/mysql-test/suite/tianmu/t/alter_table_v1.test +++ b/mysql-test/suite/tianmu/t/alter_table_v1.test @@ -55,12 +55,7 @@ drop database mysqltest; --echo # ALTER TABLE ... ENABLE/DISABLE KEYS --echo # -create table t1 (n1 int not null, n2 int, n3 int, n4 float, - unique(n1), - key (n1, n2, n3, n4), - key (n2, n3, n4, n1), - key (n3, n4, n1, n2), - key (n4, n1, n2, n3))engine=tianmu; +create table t1 (n1 int not null, n2 int, n3 int, n4 float)engine=tianmu; alter table t1 disable keys; show keys from t1; diff --git a/mysql-test/suite/tianmu/t/create_table.test b/mysql-test/suite/tianmu/t/create_table.test index 6a5f9455b..543bcd2a5 100644 --- a/mysql-test/suite/tianmu/t/create_table.test +++ b/mysql-test/suite/tianmu/t/create_table.test @@ -11,8 +11,8 @@ create table t1 (b char(0) not null)ENGINE=tianmu; --error 1048 insert into t1 values (""),(null); create table if not exists t1 (b char(0) not null)ENGINE=tianmu; ---error 1167 -create table t1 (b char(0) not null, index(b))engine=tianmu; +--error 1050 +create table t1 (b char(0) not null)engine=tianmu; drop table t1; create table `a/a` (a int)engine=tianmu; show create table `a/a`; @@ -62,8 +62,8 @@ drop table if exists ``; use test; --error 1166 create table t1 (`` int)engine=tianmu; ---error 1280 -create table t1 (i int, index `` (i))engine=tianmu; +#-error 1280 +#create table t1 (i int, index `` (i))engine=tianmu; create table t1 (i int)engine=tianmu; drop table t1; @@ -81,15 +81,6 @@ drop table t1; --echo # Test of primary key with 32 index --echo # -create table t1 (a int not null, b int, primary key(a), - key (b), key (b), key (b), key (b), key (b), key (b), - key (b), key (b), key (b), key (b), key (b), key (b), - key (b), key (b), key (b), key (b), key (b), key (b), - key (b), key (b), key (b), key (b), key (b), key (b), - key (b), key (b), key (b), key (b), key (b), key (b), - key (b))engine=tianmu; -show create table t1; -drop table t1; --echo # --echo # Test default table type @@ -147,9 +138,9 @@ create table t1 (,b int)engine=tianmu; --echo # Test create with foreign keys --echo # -create table t1 (a int, key(a))engine=tianmu; -create table t2 (b int, foreign key(b) references t1(a), key(b))engine=tianmu; -drop table if exists t1,t2; +#create table t1 (a int, key(a))engine=tianmu; +#create table t2 (b int, foreign key(b) references t1(a), key(b))engine=tianmu; +drop table if exists t1; --echo # --echo # Test for create table .. LIKE .. @@ -206,28 +197,28 @@ describe t1; drop table t1; create table t1(name varchar(10), age smallint default -1); describe t2; - +drop table t1,t2; --echo # --echo # 'Naming a key "Primary" causes trouble' --echo # ---error 1280 -create table t1 (a int, index `primary` (a))engine=tianmu; ---error 1280 -create table t1 (a int, index `PRIMARY` (a))engine=tianmu; -drop table t1; -create table t1 (`primary` int, index(`primary`))engine=tianmu; -show create table t1; -drop table t2; -create table t2 (`PRIMARY` int, index(`PRIMARY`))engine=tianmu; -show create table t2; -create table t3 (a int); ---error 1280 -alter table t3 add index `primary` (a); ---error 1280 -alter table t3 add index `PRIMARY` (a); -create table t4 (`primary` int)engine=tianmu; -drop table t1,t2,t3,t4; +#--error 1280 +#create table t1 (a int, index `primary` (a))engine=tianmu; +#--error 1280 +#create table t1 (a int, index `PRIMARY` (a))engine=tianmu; +#drop table t1; +#create table t1 (`primary` int, index(`primary`))engine=tianmu; +#show create table t1; +#drop table t2; +#create table t2 (`PRIMARY` int, index(`PRIMARY`))engine=tianmu; +#show create table t2; +#create table t3 (a int); +#--error 1280 +#alter table t3 add index `primary` (a); +#--error 1280 +#alter table t3 add index `PRIMARY` (a); +#create table t4 (`primary` int)engine=tianmu; +#drop table t1,t2,t3,t4; --echo # --echo #Can't use 'DEFAULT FALSE' for column of type bool @@ -342,7 +333,7 @@ drop tables t1,t2; --echo # Creating a base table in presence of an updatable view. --echo # -create table t2 (a int unique); +create table t2 (a int primary key); create view t1 as select a from t2; insert into t1 (a) values (1); --error 1050 diff --git a/mysql-test/suite/tianmu/t/delete.test b/mysql-test/suite/tianmu/t/delete.test index c6d4db5ee..46d6e60ac 100644 --- a/mysql-test/suite/tianmu/t/delete.test +++ b/mysql-test/suite/tianmu/t/delete.test @@ -198,7 +198,7 @@ DROP TABLE t1, t2; # deletion and KEYREAD # -create table t1 (a int, b int, unique key (a), key (b))ENGINE=TIANMU; +create table t1 (a int, b int)ENGINE=TIANMU; insert into t1 values (3, 3), (7, 7); delete from t1 where a = 3; check table t1; diff --git a/mysql-test/suite/tianmu/t/insert.test b/mysql-test/suite/tianmu/t/insert.test index d54f3b8a2..45e79597d 100644 --- a/mysql-test/suite/tianmu/t/insert.test +++ b/mysql-test/suite/tianmu/t/insert.test @@ -64,8 +64,7 @@ drop table t1; --echo # Test of duplicate key values with packed keys --echo # -create table t1 (id int not null auto_increment primary key, username varchar(32) not null, - unique (username)); +create table t1 (id int not null auto_increment primary key, username varchar(32) not null); insert into t1 values (0,"mysql"); insert into t1 values (0,"mysql ab"); insert into t1 values (0,"mysql a"); @@ -188,7 +187,7 @@ drop table t1; create table t1(id1 int not null auto_increment primary key, t char(12)); create table t2(id2 int not null, t char(12)); -create table t3(id3 int not null, t char(12), index(id3)); +create table t3(id3 int not null, t char(12)); disable_query_log; let $1 = 100; while ($1) @@ -264,7 +263,7 @@ drop table t1; --echo # ON DUPLICATE KEY clause allows fields not from the insert table --echo # -create table t1 (f1 int unique, f2 int); +create table t1 (f1 int primary key, f2 int); create table t2 (f3 int, f4 int); create view v1 as select * from t1, t2 where f1= f3; insert into t1 values (1,11), (2,22); diff --git a/mysql-test/suite/tianmu/t/insert_select.test b/mysql-test/suite/tianmu/t/insert_select.test index 5e7eae6cc..5a36e018d 100644 --- a/mysql-test/suite/tianmu/t/insert_select.test +++ b/mysql-test/suite/tianmu/t/insert_select.test @@ -81,8 +81,7 @@ CREATE TABLE t1 ( CREATE TABLE t2 ( f1 varchar(10) NOT NULL default '', f2 char(3) NOT NULL default '', - PRIMARY KEY (`f1`), - KEY `k1` (`f2`, `f1`) + PRIMARY KEY (`f1`) ); INSERT INTO t1 values(NULL, ''); diff --git a/mysql-test/suite/tianmu/t/issue1054.test b/mysql-test/suite/tianmu/t/issue1054.test index 5229471bd..b8fa918e9 100644 --- a/mysql-test/suite/tianmu/t/issue1054.test +++ b/mysql-test/suite/tianmu/t/issue1054.test @@ -87,7 +87,7 @@ CREATE TABLE `t_issue1054` ( `into` blob COMMENT 'blob', `set` text COMMENT 'text', `show` longblob COMMENT 'longblob', -UNIQUE (`usage`) +primary key (`usage`) ) engine=tianmu; insert into t_issue1054 diff --git a/mysql-test/suite/tianmu/t/issue1169.test b/mysql-test/suite/tianmu/t/issue1169.test index 38b1a936e..58c2a0649 100644 --- a/mysql-test/suite/tianmu/t/issue1169.test +++ b/mysql-test/suite/tianmu/t/issue1169.test @@ -33,11 +33,7 @@ CREATE TABLE `customer_branch_account` ( `change_sign` varchar(50) DEFAULT NULL COMMENT '', `rebate_item` varchar(30) DEFAULT NULL COMMENT '', `rebate_subitem` varchar(30) DEFAULT NULL COMMENT '', - PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `union` (`branch_org_code`,`customer_code`,`agency_org_code`,`draw_category`,`transfer_course`,`type`,`dr`) - USING BTREE COMMENT '', - KEY `idx_union` (`agency_org_code`,`customer_code`,`draw_category`,`transfer_course`,`dr`) - USING BTREE COMMENT '' + PRIMARY KEY (`id`) USING BTREE ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='关系表'; INSERT INTO `customer_branch_account` VALUES (1294275002876649148,x'E6998BE89299E58886E585ACE58FB8','RGB03-210597',x'E9A298E79BAE36E38090E5BCA0E694B9E78EB2E4B8ADE58FB0E5AD98E9878FE8A1A5E58585E5AEA2E688B7E38091','2120954','RGB03-210608',x'E995BFE6B2BB','3000252',x'E9A298E79BAE36E38090E5BCA0E694B9E78EB2E4B8ADE58FB0E5AD98E9878FE8A1A5E58585E5AEA2E688B7E38091E997A8E5BA97E4B880','PL01',0,1471413534935126016,NULL,-1,'','2021-12-16 17:34:59','','2021-12-16 17:34:59',-1,0,0,NULL,NULL,NULL); diff --git a/mysql-test/suite/tianmu/t/issue1185.test b/mysql-test/suite/tianmu/t/issue1185.test new file mode 100644 index 000000000..8c7cd0142 --- /dev/null +++ b/mysql-test/suite/tianmu/t/issue1185.test @@ -0,0 +1,383 @@ +--source include/have_tianmu.inc + +--disable_warnings +DROP DATABASE IF EXISTS issue1185_test; +--enable_warnings + +CREATE DATABASE issue1185_test; + +USE issue1185_test; + +--echo # +--echo # Secondary INDEX +--echo # + +--error 3234 +CREATE TABLE tb_stu_info (id int(11) NOT NULL, height int(11) DEFAULT NULL,KEY height (height)) ENGINE=TIANMU; +--error 3234 +CREATE TABLE tb_stu_info (id int(11) NOT NULL, height int(11) DEFAULT NULL,INDEX height (height)) ENGINE=TIANMU; + +CREATE TABLE tb_stu_info (id int, col_name varchar(10)) ENGINE=TIANMU; +--error 3234 +CREATE INDEX index_name ON tb_stu_info(column_name); +--error 3234 +ALTER TABLE tb_stu_info add INDEX index_name (col_name) ; +--error 3234 +ALTER TABLE tb_stu_info add KEY index_name (col_name) ; + +--error 3243 +ALTER TABLE tb_stu_info DROP INDEX indx_name; +--error 3243 +ALTER TABLE tb_stu_info DROP KEY indx_name; + +--error 3243 +ALTER TABLE tb_stu_info RENAME INDEX old_index_name TO new_index_name; +--error 3243 +ALTER TABLE tb_stu_info RENAME KEY old_index_name TO new_index_name; + +--echo # +--echo # UNIQUE INDEX +--echo # +--error 3235 +CREATE TABLE tb_stu_info_2 (id int(11) NOT NULL, height int(11) DEFAULT NULL,UNIQUE KEY height (height)) ENGINE=TIANMU; +--error 3235 +CREATE TABLE tb_stu_info_2 (id int(11) NOT NULL, height int(11) DEFAULT NULL,UNIQUE INDEX height (height)) ENGINE=TIANMU; +CREATE TABLE tb_stu_info_2 (id int(11) NOT NULL, height int(11) DEFAULT NULL) ENGINE=TIANMU; +--error 3235 +ALTER TABLE tb_stu_info_2 ADD CONSTRAINT constraint_name UNIQUE KEY(height); +--error 3235 +ALTER TABLE tb_stu_info_2 ADD CONSTRAINT constraint_name UNIQUE INDEX(height); +--error 3235 +CREATE UNIQUE INDEX index_name ON tb_stu_info_2(height); + +--error 3243 +ALTER TABLE tb_stu_info_2 DROP INDEX c; +--error 3243 +ALTER TABLE tb_stu_info_2 DROP KEY c; + +--error 3243 +ALTER TABLE tb_stu_info_2 RENAME INDEX old_index_name TO new_index_name; +--error 3243 +ALTER TABLE tb_stu_info_2 RENAME KEY old_index_name TO new_index_name; + +--echo # +--echo # FULL INDEX +--echo # +--error 3236 +CREATE TABLE tb_posts (id int(4) NOT NULL AUTO_INCREMENT, + title varchar(255) NOT NULL, + post_content text, + PRIMARY KEY (id), + FULLTEXT KEY post_content (post_content) +)ENGINE=TIANMU; + +CREATE TABLE tb_posts (id int(4) NOT NULL AUTO_INCREMENT, + title varchar(255) NOT NULL, + post_content text, + PRIMARY KEY (id) +)ENGINE=TIANMU; +--error 3236 +ALTER TABLE tb_posts ADD FULLTEXT INDEX index_name (post_content); +--error 3236 +CREATE FULLTEXT INDEX index_name ON tb_posts (post_content); + +--error 3243 +ALTER TABLE tb_posts DROP INDEX index_name; +--error 3243 +ALTER TABLE tb_posts DROP KEY index_name; +--error 3243 +DROP INDEX index_name ON tb_posts; + +--echo # +--echo # SPATIAL INDEX +--echo # +--error 3237 +CREATE TABLE geom (g GEOMETRY NOT NULL, SPATIAL INDEX(g)); + +--echo # +--echo # FOREIGN KEY +--echo # +CREATE TABLE customer (id int primary key) ENGINE=TIANMU; +--error 3241 +CREATE TABLE product_order ( + no INT NOT NULL , + customer_id INT NOT NULL primary key, + FOREIGN KEY (customer_id) + REFERENCES customer1(id)) ENGINE=TIANMU; +CREATE TABLE product_order ( + no INT NOT NULL , + customer_id INT NOT NULL primary key) ENGINE=TIANMU; +--error 3241 +ALTER TABLE product_order ADD CONSTRAINT fk_custome_key FOREIGN KEY(customer_id) REFERENCES customer(id); +--error 3241 +ALTER TABLE product_order DROP FOREIGN KEY customer_id; + + +--echo # +--echo # PARTITION +--echo # +--error 3242 +CREATE TABLE t1 (id INT, amount DECIMAL(7,2), tr_date DATE) ENGINE=TIANMU PARTITION BY HASH( MONTH(tr_date)) PARTITIONS 6; +CREATE TABLE t1 (id INT, amount DECIMAL(7,2), tr_date DATE) ENGINE=TIANMU; +--error 3242 +ALTER TABLE t1 ADD PARTITION (PARTITION p3 VALUES LESS THAN (2002)); +--error 3242 +ALTER TABLE t1 DROP PARTITION p0, p1; + +--echo # +--echo # GEOMETRY, ENUM, SET +--echo # +--error 3237 +CREATE TABLE geom (g GEOMETRY NOT NULL) engine=tianmu; +--error 3238 +CREATE TABLE my_enum(gender enum('male', 'female', 'secret'))engine=tianmu; +--error 3239 +CREATE TABLE myset_test(Myset SET('Java','Python','C++','PHP'))engine=tianmu; + +--echo # +--echo # TRIGGER +--echo # +CREATE TABLE employees( + id INT auto_increment PRIMARY KEY, + employeeNumber INT NOT NULL, + lastname VARCHAR(50) NOT NULL, + changedat DATETIME DEFAULT NULL, + action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; + +CREATE TABLE employees_audit( + id INT auto_increment PRIMARY KEY, + employeeNumber INT NOT NULL, + lastname VARCHAR(50) NOT NULL, + changedat DATETIME DEFAULT NULL, + action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; + +CREATE TABLE employees_audit2( + id INT auto_increment PRIMARY KEY, + employeeNumber INT NOT NULL, + lastname VARCHAR(50) NOT NULL, + changedat DATETIME DEFAULT NULL, + action VARCHAR(50) DEFAULT NULL) ENGINE=TIANMU; + + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_employee_update + BEFORE UPDATE ON employees + FOR EACH ROW +BEGIN + INSERT INTO employees_audit + SET action = 'update', + employeeNumber = OLD.employeeNumber, + lastname = OLD.lastname, + new_lastname = NEW.lastname, + changedat = NOW( ); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER after_employee_update + after UPDATE ON employees + FOR EACH ROW +BEGIN + INSERT INTO employees_audit2 + SET action = 'update', + employeeNumber = OLD.employeeNumber, + lastname = OLD.firstName, + new_lastname = NEW.firstName, + changedat = NOW( ); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_employee_insert + BEFORE INSERT ON employees + FOR EACH ROW +BEGIN + INSERT INTO employees_audit + SET action = 'insert', + employeeNumber = NEW.employeeNumber, + lastname = NEW.lastname, + new_lastname = NEW.lastname, + changedat = NOW( ); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER AFTER_employee_insert + AFTER INSERT ON employees + FOR EACH ROW +BEGIN + INSERT INTO employees_audit2 + SET action = 'insert', + employeeNumber = NEW.employeeNumber, + lastname = NEW.lastname, + new_lastname = NEW.lastname, + changedat = NOW( ); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER BEFORE_employee_delete + BEFORE DELETE ON employees + FOR EACH ROW +BEGIN + INSERT INTO employees_audit + SET action = 'delete', + employeeNumber = OLD.employeeNumber, + lastname = OLD.lastname, + new_lastname = OLD.lastname, + changedat = NOW( ); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER after_employee_delete + after DELETE ON employees + FOR EACH ROW +BEGIN + INSERT INTO employees_audit2 + SET action = 'delete', + employeeNumber = OLD.employeeNumber, + lastname = OLD.lastname, + new_lastname = OLD.lastname, + changedat = NOW( ); +END | +DELIMITER ;| + +--echo # +--echo # TRIGGER BEFORE PRECEDES/FOLLOWS +--echo # +CREATE TABLE price_logs ( + id INT(11) NOT NULL, + product_code VARCHAR(15) NOT NULL, + price DOUBLE NOT NULL, + updated_at TIMESTAMP NOT NULL +) ENGINE=tianmu; + +CREATE TABLE user_change_logs ( + id int(11) NOT NULL , + product_code varchar(15) DEFAULT NULL, + updated_at timestamp NOT NULL, + updated_by varchar(30) NOT NULL +) ENGINE=tianmu; + +CREATE TABLE `products` ( + `productCode` varchar(15) NOT NULL DEFAULT '' COMMENT '', + `productName` varchar(70) NOT NULL COMMENT '', + `productLine` varchar(50) NOT NULL COMMENT '', + `productScale` varchar(10) NOT NULL, + `productVendor` varchar(50) NOT NULL, + `productDescription` text NOT NULL, + `quantityInStock` smallint(6) NOT NULL COMMENT '', + `buyPrice` decimal(10,2) NOT NULL COMMENT '', + `MSRP` decimal(10,2) NOT NULL COMMENT '', + PRIMARY KEY (`productCode`) +) ENGINE=TIANMU DEFAULT CHARSET=utf8; + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_update +BEFORE UPDATE ON products +FOR EACH ROW +BEGIN + INSERT INTO price_logs ( product_code, price ) + VALUES(old.productCode, old.msrp); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_update_2 +BEFORE UPDATE ON products +FOR EACH ROW FOLLOWS before_products_update +BEGIN + INSERT INTO user_change_logs ( product_code, updated_by ) + VALUES(old.productCode, USER ()); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_update_2 +BEFORE UPDATE ON products +FOR EACH ROW PRECEDES before_products_update +BEGIN + INSERT INTO user_change_logs ( product_code, updated_by ) + VALUES(old.productCode, USER ()); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_insert_2 +BEFORE INSERT ON products +FOR EACH ROW FOLLOWS before_products_insert +BEGIN + INSERT INTO user_change_logs ( product_code, updated_by ) + VALUES(new.productCode, USER ()); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_insert +BEFORE INSERT ON products +FOR EACH ROW +BEGIN + INSERT INTO price_logs ( product_code, price ) + VALUES(new.productCode, new.msrp); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_insert_2 +BEFORE INSERT ON products +FOR EACH ROW PRECEDES before_products_insert +BEGIN + INSERT INTO user_change_logs ( product_code, updated_by ) + VALUES(new.productCode, USER ()); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_delete +BEFORE DELETE ON products +FOR EACH ROW +BEGIN + INSERT INTO price_logs ( product_code, price ) + VALUES(old.productCode, old.msrp); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_delete_2 +BEFORE delete ON products +FOR EACH ROW FOLLOWS before_products_delete +BEGIN + INSERT INTO user_change_logs ( product_code, updated_by ) + VALUES(old.productCode, USER ()); +END | +DELIMITER ;| + +DELIMITER |; +--error 3240 +CREATE TRIGGER before_products_delete_2 +BEFORE delete ON products +FOR EACH ROW PRECEDES before_products_delete +BEGIN + INSERT INTO user_change_logs ( product_code, updated_by ) + VALUES(old.productCode, USER ()); +END | +DELIMITER ;| + +#drop trigger before_products_delete_2; + +DROP DATABASE issue1185_test; diff --git a/mysql-test/suite/tianmu/t/issue270.test b/mysql-test/suite/tianmu/t/issue270.test index f654eb357..254d8f235 100644 --- a/mysql-test/suite/tianmu/t/issue270.test +++ b/mysql-test/suite/tianmu/t/issue270.test @@ -17,11 +17,11 @@ DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t2; DROP TABLE IF EXISTS t3; --enable_warnings -CREATE TABLE t1(a int, b int, c int, KEY b(b), KEY c(c))engine=tianmu; +CREATE TABLE t1(a int, b int, c int)engine=tianmu; insert into t1 values (1,0,0),(2,0,0); CREATE TABLE t2 (a int, b varchar(2), c varchar(2), PRIMARY KEY(a))engine=tianmu; insert into t2 values (1,'',''), (2,'',''); -CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b), KEY a (a), KEY b (b))engine=tianmu; +CREATE TABLE t3 (a int, b int, PRIMARY KEY (a,b))engine=tianmu; insert into t3 values (1,1),(1,2); --disable_warnings diff --git a/mysql-test/suite/tianmu/t/issue281.test b/mysql-test/suite/tianmu/t/issue281.test index c0634b40a..79d701094 100644 --- a/mysql-test/suite/tianmu/t/issue281.test +++ b/mysql-test/suite/tianmu/t/issue281.test @@ -11,7 +11,7 @@ USE issue281_test; --disable_warnings DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (f1 INT UNIQUE) ENGINE=TIANMU; +CREATE TABLE t1 (f1 INT) ENGINE=TIANMU; INSERT INTO t1 VALUES(1),(2),(NULL),(NULL); SELECT * FROM t1 WHERE f1 IS NULL; SELECT * FROM t1 WHERE f1 IS NOT NULL; diff --git a/mysql-test/suite/tianmu/t/issue301.test b/mysql-test/suite/tianmu/t/issue301.test index 9b350bfec..e77cb15d8 100644 --- a/mysql-test/suite/tianmu/t/issue301.test +++ b/mysql-test/suite/tianmu/t/issue301.test @@ -75,8 +75,7 @@ drop table t1,t2; SET NAMES utf8; CREATE TABLE diaries ( created_at datetime, - title varchar(256), - KEY created_at_key(created_at) + title varchar(256) ) engine=tianmu DEFAULT CHARSET=utf8; INSERT INTO diaries VALUES ("1000-01-01 00:00:00", "The start"); @@ -84,18 +83,13 @@ INSERT INTO diaries VALUES ("2012-10-25 16:18:29", "Today is shiny day."); INSERT INTO diaries VALUES ("9999-12-31 23:59:59", "The end"); SELECT * - FROM diaries FORCE INDEX(created_at_key) + FROM diaries WHERE created_at = created_at or created_at = "2012-10-25 16:18:29"; -SELECT * - FROM diaries FORCE INDEX(created_at_key) - WHERE created_at = created_at and created_at = "2012-10-25 16:18:29"; - DROP TABLE diaries; CREATE TABLE tags ( - name VARCHAR(16) NOT NULL, - KEY index_name (name) + name VARCHAR(16) NOT NULL )engine=tianmu; INSERT INTO tags VALUES ('mroonga'); diff --git a/mysql-test/suite/tianmu/t/issue364.test b/mysql-test/suite/tianmu/t/issue364.test.bak similarity index 100% rename from mysql-test/suite/tianmu/t/issue364.test rename to mysql-test/suite/tianmu/t/issue364.test.bak diff --git a/mysql-test/suite/tianmu/t/issue581.test b/mysql-test/suite/tianmu/t/issue581.test.bak similarity index 100% rename from mysql-test/suite/tianmu/t/issue581.test rename to mysql-test/suite/tianmu/t/issue581.test.bak diff --git a/mysql-test/suite/tianmu/t/issue790.test b/mysql-test/suite/tianmu/t/issue790.test index bc3f244d5..249301578 100644 --- a/mysql-test/suite/tianmu/t/issue790.test +++ b/mysql-test/suite/tianmu/t/issue790.test @@ -31,9 +31,7 @@ CREATE TABLE `account` ( `version` int(11) DEFAULT '0' COMMENT '', `account_balance` decimal(15,2) DEFAULT '0.00' COMMENT '', `order_froze_amount` decimal(15,2) DEFAULT NULL COMMENT '', - PRIMARY KEY (`id`), - UNIQUE KEY `account_acc_id_uindex` (`acc_id`), - KEY `index_name` (`acc_id`) + PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COMMENT='账户'; CREATE TABLE `account_statement` ( @@ -60,9 +58,7 @@ CREATE TABLE `account_statement` ( `after_froze_amount` decimal(15,2) DEFAULT '0.00' COMMENT '', `before_froze_order_amount` decimal(15,2) DEFAULT NULL COMMENT '', `after_froze_order_amount` decimal(15,2) DEFAULT NULL COMMENT '', - PRIMARY KEY (`id`), - KEY `index_business_no` (`business_no`), - KEY `index_name` (`acc_id`) + PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 COMMENT='账户流水'; CREATE TABLE `customer_branch_account` ( @@ -90,11 +86,7 @@ CREATE TABLE `customer_branch_account` ( `change_sign` varchar(50) DEFAULT NULL COMMENT '', `rebate_item` varchar(30) DEFAULT NULL COMMENT '', `rebate_subitem` varchar(30) DEFAULT NULL COMMENT '', - PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `union` (`branch_org_code`,`customer_code`,`agency_org_code`,`draw_category`,`transfer_course`,`type`,`dr`) - USING BTREE COMMENT '', - KEY `idx_union` (`agency_org_code`,`customer_code`,`draw_category`,`transfer_course`,`dr`) - USING BTREE COMMENT '' + PRIMARY KEY (`id`) USING BTREE ) ENGINE=TIANMU DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='关系表'; --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR diff --git a/mysql-test/suite/tianmu/t/issue880.test b/mysql-test/suite/tianmu/t/issue880.test index 10f245f89..5eedb88ae 100644 --- a/mysql-test/suite/tianmu/t/issue880.test +++ b/mysql-test/suite/tianmu/t/issue880.test @@ -44,11 +44,7 @@ CREATE TABLE `issue880_t1` ( `operator` varchar(50) DEFAULT NULL COMMENT '操作人; Size[MB]: 0.1; Ratio: 0.02', `operator_id` int(11) DEFAULT NULL COMMENT '操作人id; Size[MB]: 0.1; Ratio: 1.78', `remark` varchar(50) DEFAULT NULL COMMENT '备注; Size[MB]: 0.1; Ratio: 0.02', - PRIMARY KEY (`id`), - UNIQUE KEY `company_account_change_id` (`id`), - KEY `company_change_company_id` (`COMPANY_ID`), - KEY `period_pay_id_index` (`period_pay_id`), - KEY `period_account_id_index` (`period_account_id`) + PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED; @@ -97,12 +93,7 @@ CREATE TABLE `issue880_t2` ( `subscribe_number` varchar(5000) DEFAULT NULL COMMENT '订阅编号; Size[MB]: 0.1; Ratio: 0.04', `settlement_status` smallint(1) DEFAULT '1' COMMENT '是否需要结算0不需要,1需要; Size[MB]: 0.1; Ratio: 1.60', `company_type` smallint(1) DEFAULT '1' COMMENT '公司类型(1:运营商,2:合作伙伴); Size[MB]: 0.1; Ratio: 2.12', - PRIMARY KEY (`id`), - UNIQUE KEY `period_account_id` (`id`), - KEY `period_account_company_id` (`company_id`), - KEY `index_pay_type` (`pay_type`), - KEY `index_pay_status` (`pay_status`), - KEY `index_type_status` (`pay_type`,`pay_status`) + PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED; CREATE TABLE `issue880_t3` ( @@ -124,11 +115,7 @@ CREATE TABLE `issue880_t3` ( `account_number` varchar(20) DEFAULT NULL COMMENT '交易银行账户; Size[MB]: 0.1; Ratio: 0.04', `pay_flag` smallint(1) DEFAULT '0' COMMENT '是否需要支付,0需要,1不需要; Size[MB]: 0.1; Ratio: 0.24', `union_order_flag` smallint(1) DEFAULT '0' COMMENT '是否合成订单0不是,1是; Size[MB]: 0.1; Ratio: 2.12', - PRIMARY KEY (`id`), - UNIQUE KEY `pay_id` (`id`), - UNIQUE KEY `pay_order_no` (`order_no`), - KEY `pay_status_index` (`pay_status`), - KEY `idx_pay_status_feetype` (`pay_status`,`fee_type`) + PRIMARY KEY (`id`) ) ENGINE=TIANMU DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED; --disable_warnings diff --git a/mysql-test/suite/tianmu/t/issue964.test b/mysql-test/suite/tianmu/t/issue964.test index 71704d4d9..7e5ffcee1 100644 --- a/mysql-test/suite/tianmu/t/issue964.test +++ b/mysql-test/suite/tianmu/t/issue964.test @@ -16,14 +16,14 @@ DROP TABLE IF EXISTS t1,t2; CREATE TABLE `t1` ( `id` int(11) DEFAULT NULL, - `name` varchar(20) DEFAULT NULL, - KEY `idx_n` (`name`) + `name` varchar(20), + PRIMARY KEY `idx_n` (`name`) ) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; CREATE TABLE `t2` ( `id` int(11) DEFAULT NULL, - `name` varchar(20) DEFAULT NULL, - KEY `idx_n` (`name`) + `name` varchar(20), + PRIMARY KEY `idx_n` (`name`) )DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; ## insert data, only for table t1 diff --git a/mysql-test/suite/tianmu/t/select.test b/mysql-test/suite/tianmu/t/select.test index 66d5d2fb1..2d3a9e999 100644 --- a/mysql-test/suite/tianmu/t/select.test +++ b/mysql-test/suite/tianmu/t/select.test @@ -41,8 +41,6 @@ CREATE TABLE t2 ( fld4 char(35) DEFAULT '' NOT NULL, fld5 char(35) DEFAULT '' NOT NULL, fld6 char(4) DEFAULT '' NOT NULL, - UNIQUE fld1 (fld1), - KEY fld3 (fld3), PRIMARY KEY (auto) )engine=tianmu; @@ -1287,10 +1285,10 @@ select t2.fld3 from t2 where fld3 LIKE 'don_t_find_me_please%'; --echo # select t2.fld3 from t2 where fld3 = 'honeysuckle'; -select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; -select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; -select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; -select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; +#select fld3 from t2 ignore index (fld3) where fld3 = 'honeysuckle'; +#select fld3 from t2 use index (fld1) where fld3 = 'honeysuckle'; +#select fld3 from t2 use index (fld3) where fld3 = 'honeysuckle'; +#select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; --echo # --echo # NOTE NOTE NOTE @@ -1298,9 +1296,9 @@ select fld3 from t2 use index (fld1,fld3) where fld3 = 'honeysuckle'; --echo # -- error 1176 -select fld3 from t2 ignore index (fld3,not_used); +#select fld3 from t2 ignore index (fld3,not_used); -- error 1176 -select fld3 from t2 use index (not_used); +#select fld3 from t2 use index (not_used); --echo # --echo # Test sorting with a used key (there is no need for sorting) @@ -1364,9 +1362,7 @@ create table t3 ( name char(32) not null, companynr int not null, price double(11,0), - price2 double(11,0), - key (period), - key (name) + price2 double(11,0) )engine=tianmu; #insert into 10 number @@ -1387,9 +1383,7 @@ create table t3_1 ( name char(32) not null, companynr int not null, price double(11,0), - price2 double(11,0), - key (period), - key (name) + price2 double(11,0) )engine=tianmu; --echo #Reverse insert data diff --git a/mysql-test/suite/tianmu/t/trigger.test b/mysql-test/suite/tianmu/t/trigger.test.bak similarity index 100% rename from mysql-test/suite/tianmu/t/trigger.test rename to mysql-test/suite/tianmu/t/trigger.test.bak diff --git a/mysql-test/suite/tianmu/t/update_v1.test b/mysql-test/suite/tianmu/t/update_v1.test index 1f858b349..fd4f0c6f8 100644 --- a/mysql-test/suite/tianmu/t/update_v1.test +++ b/mysql-test/suite/tianmu/t/update_v1.test @@ -71,12 +71,7 @@ CREATE TABLE t1 ( body text NOT NULL, comment text, header text, - PRIMARY KEY (lfdnr), - KEY k1 (timestamp), - KEY k2 (type), - KEY k3 (parent), - KEY k4 (assignment), - KEY ticket (ticket) + PRIMARY KEY (lfdnr) ) ENGINE=tianmu; INSERT INTO t1 VALUES (773,773,'','','',980257344,20010318180652,0,'Open',10,0,0,0,1,'','','','',''); @@ -92,8 +87,7 @@ drop table t1; CREATE TABLE t1 ( `id_param` smallint(3) NOT NULL default '0', `nom_option` char(40) NOT NULL default '', - `valid` tinyint(1) NOT NULL default '0', - KEY `id_param` (`id_param`,`nom_option`) + `valid` tinyint(1) NOT NULL default '0' ) ENGINE=tianmu; INSERT INTO t1 (id_param,nom_option,valid) VALUES (185,'600x1200',1); @@ -128,7 +122,7 @@ drop table t1; --echo # a problem with update and partial key part --echo # -create table t1 (a int, b char(255), key(a, b(20))); +create table t1 (a int, b char(255)); insert into t1 values (0, '1'); update t1 set b = b + 1 where a = 0; select * from t1; @@ -186,8 +180,7 @@ drop table t1; CREATE TABLE t1 ( a INT(11), quux decimal(17, 10), - UNIQUE KEY bar (a), - KEY quux (quux) + PRIMARY KEY bar (a) )engine=tianmu; INSERT INTO @@ -221,8 +214,7 @@ DROP TABLE t1; CREATE TABLE t1( id INTEGER NOT NULL AUTO_INCREMENT, token VARCHAR(255) DEFAULT NULL, -PRIMARY KEY (id), -KEY token (token) +PRIMARY KEY (id) )engine=tianmu; INSERT INTO t1 VALUES (1, "abc"), (2, "def"); diff --git a/sql/auth/sql_authorization.cc b/sql/auth/sql_authorization.cc index 8338d51ff..443b3cece 100644 --- a/sql/auth/sql_authorization.cc +++ b/sql/auth/sql_authorization.cc @@ -4388,8 +4388,15 @@ bool check_fk_parent_table_access(THD *thd, ha_default_handlerton(thd); // Return if engine does not support Foreign key Constraint. - if (!ha_check_storage_engine_flag(db_type, HTON_SUPPORTS_FOREIGN_KEYS)) + if (!ha_check_storage_engine_flag(db_type, HTON_SUPPORTS_FOREIGN_KEYS)) { + if (db_type == tianmu_hton && + (alter_info->flags & Alter_info::ADD_FOREIGN_KEY)) { + my_error(ER_TIANMU_NOT_SUPPORTED_FOREIGN_KEY, MYF(0)); + return true; + } + return false; + } while ((key= key_iterator++)) { diff --git a/sql/handler.h b/sql/handler.h index 16072f9d1..fb2271b14 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -306,6 +306,14 @@ enum enum_alter_inplace_result { The handler supports non-KEY auto_increment column */ #define HA_NON_KEY_AUTO_INC (1LL << 48) //TIANMU UPGRADE +/* + The handler does not support secondary key +*/ +#define HA_NON_SECONDARY_KEY (1LL << 49) +/* + The handler does not support unique key +*/ +#define HA_NON_UNIQUE_KEY (1LL << 50) /* bits in index_flags(index_number) for what you can do with index */ #define HA_READ_NEXT 1 /* TODO really use this flag */ diff --git a/sql/partition_info.cc b/sql/partition_info.cc index 40dfb3924..86a865b50 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -1212,7 +1212,11 @@ bool partition_info::check_engine_mix(handlerton *engine_type, engine_type= old_engine_type; if (engine_type->flags & HTON_NO_PARTITION) { - my_error(ER_PARTITION_MERGE_ERROR, MYF(0)); + if (engine_type == tianmu_hton) { + my_error(ER_TIANMU_NOT_SUPPORTED_PARTITION, MYF(0)); + } else { + my_error(ER_PARTITION_MERGE_ERROR, MYF(0)); + } DBUG_RETURN(TRUE); } DBUG_PRINT("info", ("out: engine_type = %s", diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index becaca3e8..1dd38bc4d 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7796,6 +7796,36 @@ ER_DEPRECATED_TLS_VERSION_SESSION ER_WARN_DEPRECATED_TLS_VERSION eng "A deprecated TLS version %s is enabled. Please use TLSv1.2 or higher." +ER_TIANMU_NOT_SUPPORTED_SECONDARY_INDEX + eng "Tianmu engine does not support secondary index." + +ER_TIANMU_NOT_SUPPORTED_UNIQUE_INDEX + eng "Tianmu engine does not support unique index." + +ER_TIANMU_NOT_SUPPORTED_FULLTEXT_INDEX + eng "Tianmu engine does not support fulltext index." + +ER_TIANMU_NOT_SUPPORTED_GEOMETRY + eng "Tianmu engine does not support gemoetry." + +ER_TIANMU_NOT_SUPPORTED_ENUM + eng "Tianmu engine does not support enum data type." + +ER_TIANMU_NOT_SUPPORTED_SET + eng "Tianmu engine does not support set data type." + +ER_TIANMU_NOT_SUPPORTED_TRIGGER + eng "Tianmu engine does not support trigger." + +ER_TIANMU_NOT_SUPPORTED_FOREIGN_KEY + eng "Tianmu engine does not support foreign key." + +ER_TIANMU_NOT_SUPPORTED_PARTITION + eng "Tianmu engine does not support partition." + +ER_TIANMU_NOT_FOUND_INDEX + eng "Tianmu engine does not find the index." + # # End of 5.7 error messages. # diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index f16e33b69..575988e41 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -5010,7 +5010,11 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info, if (!table->part_info) { - my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0)); + if (create_info->db_type->db_type == DB_TYPE_TIANMU) { + my_error(ER_TIANMU_NOT_SUPPORTED_PARTITION, MYF(0)); + } else { + my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0)); + } DBUG_RETURN(TRUE); } if (!part_handler) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8c1e55041..59f0259ac 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3031,10 +3031,8 @@ static void calculate_interval_lengths(const CHARSET_INFO *cs, 1 Error */ -int prepare_create_field(Create_field *sql_field, - uint *blob_columns, - longlong table_flags) -{ +int prepare_create_field(Create_field *sql_field, uint *blob_columns, + longlong table_flags, enum legacy_db_type db_type) { unsigned int dup_val_count; DBUG_ENTER("prepare_field"); @@ -3061,8 +3059,12 @@ int prepare_create_field(Create_field *sql_field, case MYSQL_TYPE_GEOMETRY: if (!(table_flags & HA_CAN_GEOMETRY)) { - my_printf_error(ER_CHECK_NOT_IMPLEMENTED, ER(ER_CHECK_NOT_IMPLEMENTED), - MYF(0), "GEOMETRY"); + if (db_type == DB_TYPE_TIANMU) { + my_error(ER_TIANMU_NOT_SUPPORTED_GEOMETRY, MYF(0)); + } else { + my_printf_error(ER_CHECK_NOT_IMPLEMENTED, ER(ER_CHECK_NOT_IMPLEMENTED), + MYF(0), "GEOMETRY"); + } DBUG_RETURN(1); } sql_field->pack_flag=FIELDFLAG_GEOM | @@ -3108,6 +3110,10 @@ int prepare_create_field(Create_field *sql_field, sql_field->pack_flag|=FIELDFLAG_BINARY; break; case MYSQL_TYPE_ENUM: + if (db_type == DB_TYPE_TIANMU) { + my_error(ER_TIANMU_NOT_SUPPORTED_ENUM, MYF(0)); + DBUG_RETURN(1); + } sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) | FIELDFLAG_INTERVAL; if (sql_field->charset->state & MY_CS_BINSORT) @@ -3119,6 +3125,10 @@ int prepare_create_field(Create_field *sql_field, DBUG_RETURN(1); break; case MYSQL_TYPE_SET: + if (db_type == DB_TYPE_TIANMU) { + my_error(ER_TIANMU_NOT_SUPPORTED_SET, MYF(0)); + DBUG_RETURN(1); + } sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) | FIELDFLAG_BITFIELD; if (sql_field->charset->state & MY_CS_BINSORT) @@ -3178,7 +3188,6 @@ int prepare_create_field(Create_field *sql_field, DBUG_RETURN(0); } - static TYPELIB *create_typelib(MEM_ROOT *mem_root, Create_field *field_def, List *src) @@ -3827,8 +3836,8 @@ mysql_prepare_create_table(THD *thd, const char *error_schema_name, { assert(sql_field->charset != 0); - if (prepare_create_field(sql_field, &blob_columns, - file->ha_table_flags())) + if (prepare_create_field(sql_field, &blob_columns, file->ha_table_flags(), + create_info->db_type->db_type)) DBUG_RETURN(TRUE); if (sql_field->sql_type == MYSQL_TYPE_VARCHAR) create_info->varchar= TRUE; @@ -3924,6 +3933,20 @@ mysql_prepare_create_table(THD *thd, const char *error_schema_name, } (*key_count)++; tmp=file->max_key_parts(); + + if (create_info->db_type->db_type == DB_TYPE_TIANMU) { + if ((file->ha_table_flags() & HA_NON_SECONDARY_KEY) && + key->type == KEYTYPE_MULTIPLE) { + my_error(ER_TIANMU_NOT_SUPPORTED_SECONDARY_INDEX, MYF(0)); + DBUG_RETURN(TRUE); + } + if (file->ha_table_flags() & HA_NON_UNIQUE_KEY && + key->type == KEYTYPE_UNIQUE) { + my_error(ER_TIANMU_NOT_SUPPORTED_UNIQUE_INDEX, MYF(0)); + DBUG_RETURN(TRUE); + } + } + if (key->columns.elements > tmp && key->type != KEYTYPE_SPATIAL) { my_error(ER_TOO_MANY_KEY_PARTS,MYF(0),tmp); @@ -4055,9 +4078,14 @@ mysql_prepare_create_table(THD *thd, const char *error_schema_name, MYF(0)); DBUG_RETURN(TRUE); } - my_message(ER_TABLE_CANT_HANDLE_FT, ER(ER_TABLE_CANT_HANDLE_FT), - MYF(0)); - DBUG_RETURN(TRUE); + if (create_info->db_type->db_type == DB_TYPE_TIANMU) { + my_message(ER_TIANMU_NOT_SUPPORTED_FULLTEXT_INDEX, + ER(ER_TIANMU_NOT_SUPPORTED_FULLTEXT_INDEX), MYF(0)); + } else { + my_message(ER_TABLE_CANT_HANDLE_FT, ER(ER_TABLE_CANT_HANDLE_FT), + MYF(0)); + } + DBUG_RETURN(TRUE); } } /* @@ -8465,11 +8493,19 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, while ((drop=drop_it++)) { switch (drop->type) { case Alter_drop::KEY: + if (create_info->db_type->db_type == DB_TYPE_TIANMU) { + my_error(ER_TIANMU_NOT_FOUND_INDEX, MYF(0)); + goto err; + } + /*fall through*/ case Alter_drop::COLUMN: my_error(ER_CANT_DROP_FIELD_OR_KEY, MYF(0), alter_info->drop_list.head()->name); goto err; case Alter_drop::FOREIGN_KEY: + if (create_info->db_type->db_type == DB_TYPE_TIANMU) { + my_error(ER_TIANMU_NOT_SUPPORTED_FOREIGN_KEY, MYF(0)); + } break; default: assert(false); @@ -8481,8 +8517,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, } if (rename_key_list.elements) { - my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), rename_key_list.head()->old_name, - table->s->table_name.str); + if (create_info->db_type->db_type == DB_TYPE_TIANMU) { + my_error(ER_TIANMU_NOT_FOUND_INDEX, MYF(0)); + } else { + my_error(ER_KEY_DOES_NOT_EXITS, MYF(0), rename_key_list.head()->old_name, + table->s->table_name.str); + } goto err; } @@ -9341,9 +9381,10 @@ bool mysql_alter_table(THD *thd, const char *new_db, const char *new_name, till this point for the alter operation. */ if ((alter_info->flags & Alter_info::ADD_FOREIGN_KEY) && - check_fk_parent_table_access(thd, alter_ctx.new_db, - create_info, alter_info)) + check_fk_parent_table_access(thd, alter_ctx.new_db, create_info, + alter_info)) { DBUG_RETURN(true); + } /* If this is an ALTER TABLE and no explicit row type specified reuse diff --git a/sql/sql_table.h b/sql/sql_table.h index 318b29a12..45578912b 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -23,14 +23,12 @@ #ifndef SQL_TABLE_INCLUDED #define SQL_TABLE_INCLUDED -#include "my_global.h" /* my_bool */ -#include "m_ctype.h" /* CHARSET_INFO */ -#include "mysql_com.h" /* enum_field_types */ -#include "mysql/psi/mysql_thread.h" /* mysql_mutex_t */ -#include "my_global.h" /* my_bool */ -#include "m_ctype.h" /* CHARSET_INFO */ -#include "mysql_com.h" /* enum_field_types */ -#include "mysql/psi/mysql_thread.h" /* mysql_mutex_t */ +#include "handler.h" +#include "m_ctype.h" /* CHARSET_INFO */ +#include "my_global.h" /* my_bool */ +#include "mysql/psi/mysql_thread.h" /* mysql_mutex_t */ +#include "mysql_com.h" /* enum_field_types */ + class Alter_info; class Alter_table_ctx; @@ -225,9 +223,9 @@ bool fill_field_definition(THD *thd, class sp_head *sp, enum enum_field_types field_type, Create_field *field_def); -int prepare_create_field(Create_field *sql_field, - uint *blob_columns, - longlong table_flags); +int prepare_create_field(Create_field *sql_field, uint *blob_columns, + longlong table_flags, + enum legacy_db_type db_type = DB_TYPE_DEFAULT); const CHARSET_INFO* get_sql_field_charset(Create_field *sql_field, HA_CREATE_INFO *create_info); bool mysql_write_frm(ALTER_PARTITION_PARAM_TYPE *lpt, uint flags); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 9354bdbae..1e358a019 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -226,6 +226,10 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) } table= tables->table; table->pos_in_table_list= tables; + if (table->file && table->file->ht == tianmu_hton) { + my_error(ER_TIANMU_NOT_SUPPORTED_TRIGGER, MYF(0)); + goto end; + } /* Later on we will need it to downgrade the lock */ mdl_ticket= table->mdl_ticket; diff --git a/storage/tianmu/handler/ha_tianmu.cpp b/storage/tianmu/handler/ha_tianmu.cpp index 56d243163..31a09056a 100644 --- a/storage/tianmu/handler/ha_tianmu.cpp +++ b/storage/tianmu/handler/ha_tianmu.cpp @@ -2024,7 +2024,7 @@ int tianmu_init_func(void *p) { tianmu_hton->state = SHOW_OPTION_YES; tianmu_hton->db_type = DB_TYPE_TIANMU; tianmu_hton->create = tianmu_create_handler; - tianmu_hton->flags = HTON_NO_FLAGS; + tianmu_hton->flags = HTON_NO_PARTITION; tianmu_hton->panic = tianmu_panic_func; tianmu_hton->close_connection = tianmu_close_connection; tianmu_hton->commit = tianmu_commit; diff --git a/storage/tianmu/handler/ha_tianmu.h b/storage/tianmu/handler/ha_tianmu.h index 396ebe292..ba19d3f16 100644 --- a/storage/tianmu/handler/ha_tianmu.h +++ b/storage/tianmu/handler/ha_tianmu.h @@ -50,7 +50,7 @@ class ha_tianmu final : public handler { ulonglong table_flags() const override { return HA_NON_KEY_AUTO_INC | HA_REC_NOT_IN_SEQ | HA_PARTIAL_COLUMN_READ | HA_BINLOG_STMT_CAPABLE | HA_BLOCK_CONST_TABLE | HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_NULL_IN_KEY | HA_DUPLICATE_POS | - HA_PRIMARY_KEY_IN_READ_INDEX | HA_BINLOG_ROW_CAPABLE; + HA_PRIMARY_KEY_IN_READ_INDEX | HA_BINLOG_ROW_CAPABLE | HA_NON_SECONDARY_KEY | HA_NON_UNIQUE_KEY; } /* This is a bitmap of flags that says how the storage engine diff --git a/website/i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment/deploy-stonedb-with-deb.md b/website/i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment/deploy-stonedb-with-deb.md index 2b17772aa..6ae2eb4fa 100644 --- a/website/i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment/deploy-stonedb-with-deb.md +++ b/website/i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment/deploy-stonedb-with-deb.md @@ -3,7 +3,7 @@ id: deploy-stonedb-with-deb sidebar_position: 3.14 --- -# **Ubuntu 20 下通过 DEB 包部署 StoneDB** +# Ubuntu 20 下通过 DEB 包部署 StoneDB ## 步骤 1:安装 StoneDB 1. 下载 StoneDB 软件包。您可以通过以下两种方式进行下载: diff --git a/website/i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment/deploy-stonedb-with-tar.md b/website/i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment/deploy-stonedb-with-tar.md index 291d5515c..007bf44bd 100644 --- a/website/i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment/deploy-stonedb-with-tar.md +++ b/website/i18n/zh/docusaurus-plugin-content-docs/current/02-getting-started/quick-deployment/deploy-stonedb-with-tar.md @@ -3,7 +3,7 @@ id: deploy-stonedb-with-tar sidebar_position: 3.13 --- -# **使用 TAR 包快速部署 StoneDB** +# 使用 TAR 包快速部署 StoneDB ## 步骤 1:安装 StoneDB 1. 下载 StoneDB 软件包。 diff --git a/website/i18n/zh/docusaurus-plugin-content-pages/index.md b/website/i18n/zh/docusaurus-plugin-content-pages/index.md index 16736ef57..4dfeb27f2 100644 --- a/website/i18n/zh/docusaurus-plugin-content-pages/index.md +++ b/website/i18n/zh/docusaurus-plugin-content-pages/index.md @@ -79,22 +79,22 @@ StoneDB for MySQL - 减少企业的TCO成本,人人皆可获得低成本的数据服务。 ``` -```custom-roadMap 2023 年 01 月 15 日 +```custom-roadMap 2023-01-15 - Roadmap - StoneDB_5.6_v1.0.0 1. 一体化行列混存+内存计算架构 2. 基于代价的智能HTAP查询引擎 3. 智能压缩技术 - - 2022 年 6 月 29 日 + - 2022-06-29 - StoneDB_5.7_v1.0.0 - 适配 MySQL 5.7 - - 2022 年 8 月 31 日 + - 2022-08-31 - StoneDB_5.7_v1.0.1 1. 提升TPC-H中8个慢SQL 2. 优化查询模块 3. 增加 delete 功能 4. 增加 binlog 复制,支持 row 格式 - - 2022 年 10 月 24 日 + - 2022-10-24 - StoneDB_5.7_v1.0.2 1. 支持自定义函数。 2. 支持转义功能。 @@ -106,29 +106,29 @@ StoneDB for MySQL 6. 支持 replace into 功能。 7. 支持(语法上)支持unsigned 和zerofill。 8. sql_mode增加强制Tianmu引擎参数:MANDATORY_TIANMU。 - - 2023 年 01 月 15 日 + - 2023-01-15 - StoneDB_5.7_v1.0.3 1. 主备集群能力增强 2. 部分数据对象的定义 3. Binlog 改造 4. 主备集群自动寻主功能 - - 2023 年 02 月 30 日 + - 2023-02-30 - StoneDB_5.7_v1.0.4 1. 存储过程增强 2. MySQL Event(批量加工能力) 3. 窗口函数 4. 安全功能-身份鉴别增强、存储加密 - - 2023 年 04 月 30 日 + - 2023-04-30 - StoneDB_5.7_v1.0.5 1. 性能增强-并行执行能力(Parallel) 2. 性能增强-向量计算 3. 多主一从架构 4. 数据交换(多种导出格式) 5. 安全功能-传输加密、数据脱敏 - - 2023 年 06 月 30 日 + - 2023-06-30 - StoneDB_8.0_v1.0.0 - 适配 MySQL 8.0 - - 2023 年 03 月 06 日 + - 2023-03-06 - StoneDB_v2.0.0 - 全新架构 - 2023年~ diff --git a/website/package-lock.json b/website/package-lock.json index bcd6edd72..fd55fd52a 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -14713,7 +14713,9 @@ } }, "node_modules/ua-parser-js": { - "version": "0.7.31", + "version": "0.7.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", + "integrity": "sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==", "funding": [ { "type": "opencollective", @@ -14724,7 +14726,6 @@ "url": "https://paypal.me/faisalman" } ], - "license": "MIT", "engines": { "node": "*" } @@ -25072,7 +25073,9 @@ "version": "4.8.3" }, "ua-parser-js": { - "version": "0.7.31" + "version": "0.7.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", + "integrity": "sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==" }, "unbox-primitive": { "version": "1.0.2", diff --git a/website/src/components/roadMap/step/index.tsx b/website/src/components/roadMap/step/index.tsx index c043fd974..3b8d4806b 100644 --- a/website/src/components/roadMap/step/index.tsx +++ b/website/src/components/roadMap/step/index.tsx @@ -6,7 +6,7 @@ import {StepWrap, StepItemWrap, StepContext, ButtonWrap, ButtonIcon, Logo} from export const Step: React.FC = ({dataSource, value}) => { const [scroll, setScroll] = useState(0); const { ref, inView } = useInView({ - threshold: 0, + threshold: 0.8, }); const checkActive = (time: string) => { @@ -29,12 +29,12 @@ export const Step: React.FC = ({dataSource, value}) => { } const scrollNext = () => { - setScroll((scroll) => scroll += 300) + setScroll((scroll) => scroll += 320) } return ( - +
{ dataSource.map(({title, desc, time, list}, index: number) => { diff --git a/website/src/components/roadMap/step/styles.ts b/website/src/components/roadMap/step/styles.ts index 85f10d54b..f44410ca9 100644 --- a/website/src/components/roadMap/step/styles.ts +++ b/website/src/components/roadMap/step/styles.ts @@ -123,6 +123,7 @@ export const StepItemWrap: StyledComponent<"div", any, {active?: boolean;disable display: flex; flex-direction: column; justify-content: space-between; + overflow-y: auto; p { font-size: 18px; font-weight: 400; @@ -149,10 +150,11 @@ export const StepContext = styled(Context)` padding: 0; z-index: 0; .wrap{ - width: 200%; + min-width: 100%; height: 100%; - ${({scroll}: any) => ` - transform: translateX(-${scroll}px); + ${({scroll, counts}: any) => ` + width: ${counts*320}px; + transform: translateX(-${scroll <=0 ? 0 : scroll}px); `} } `