首批通过分布式安全可靠测评,为关键业务系统打造
建表时定义 global partition index 报错
更新时间:2024-01-22 01:56
问题描述
建表时定义 global partition index 会报语法错误。
建表语句如下。
create table T1 (
a int,
b int,
c int,
CONSTRAINT pk_a PRIMARY KEY (`a`),
KEY `index_b` (`b`) GLOBAL partition by key(`b`) partitions 128);
返回结果如下。
ErrorCode = 1064, SQLState = 42000, Details = You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'partition by key(`b`) partitions 128 at line 1
适用版本
OceanBase 数据库 V2.x、V3.x 版本。
问题原因
目前 OceanBase 数据库 V2.2.7x 及所有 V3.x 版本都不支持在建表时定义 global partition index。
解决方法
建表时不带 global partiton index,建表后通过以下语句创建。
create index `index_xxxx` (`xxxx`) global partition by key(`xxxx`) partitions 128;