修改字段类型报错:ERROR 1235 (0A000): Alter non string type not supported

【产品名称】oceanbase

【产品版本】v3.1.2-OceanBase-CE

【问题描述】

OceanBase不支持跨字段类型修改吗?测试SQL语句如下,希望将int类型改为varchar类型

MySQL [test]> show create table t1; ±------±-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | ±------±-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | t1 | CREATE TABLE `t1` ( `idx` int(11) NOT NULL, `c1` bigint(20) DEFAULT NULL, `c2` varchar(32) DEFAULT NULL, PRIMARY KEY (`idx`) ) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = COMPACT COMPRESSION = ‘zstd_1.3.8’ REPLICA_NUM = 3 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0 | ±------±-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.02 sec) MySQL [test]> ALTERE TABLE t1 MODIFY COLUMN c1 varchar(20) DEFAULT NULL; ERROR 1235 (0A000): Alter non string type not supported

OB目前的DDL修改列类型(兼容类型向上修改) 例如: int 改 bigint、varchar 改 text、blob 改 long blob 等,

修改列类型(不兼容类型修改) 例如: int 改 varchar、char 改 varchar 等。

https://open.oceanbase.com/docs/observer-cn/V3.1.1/10000000000013308

1 个赞