Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tianmu): unsupported DDL in SQL layer should report error. (#1185) #1246

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions include/mysqld_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
41 changes: 1 addition & 40 deletions mysql-test/suite/tianmu/r/alter_table_v1.result
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
119 changes: 7 additions & 112 deletions mysql-test/suite/tianmu/r/create_table.result
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down Expand Up @@ -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;
#
Expand All @@ -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
#
Expand Down Expand Up @@ -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 ..
#
Expand Down Expand Up @@ -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
#
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/tianmu/r/delete.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions mysql-test/suite/tianmu/r/insert.result
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions mysql-test/suite/tianmu/r/insert_select.result
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/tianmu/r/issue1054.result
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 1 addition & 5 deletions mysql-test/suite/tianmu/r/issue1169.result
Original file line number Diff line number Diff line change
Expand Up @@ -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' ;
Expand Down
Loading