基于湖库一体架构,统一管理结构化、半结构化与非结构化等多模态数据,一个系统承载事务处理、实时分析与 AI 工作负载。
OceanBase 数据库 MySQL 模式暂不支持的 DDL 命令总结
更新时间:2026-05-21 09:16
本文主要介绍 MySQL 模式中暂不支持的 DDL 语法。
样例表:
MySQL [test]> CREATE TABLE `t1` (`id` varchar(64) DEFAULT NULL);
Query OK, 0 rows affected (0.064 sec)
暂不支持缩短字段的长度。
MySQL [test]> alter table t1 modify column `id` varchar(32); ERROR 1235 (0A000): Truncate the data of column schema not supported暂不支持添加非空约束。
MySQL [test]> alter table t1 modify column `id` varchar(64) not null; ERROR 1138 (22004): Invalid use of NULL value暂不支持增加、删除、修改主键。
MySQL [test]> alter table t1 add PRIMARY KEY (`id`); ERROR 1235 (0A000): Not supported feature or functionMySQL [test]> alter table t1 drop primary key; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'primary key' at line 1MySQL [test]> alter table t1 add primary key (`time`); ERROR 1235 (0A000): Not supported feature or function暂不支持不兼容列类型的修改。
MySQL [test]> CREATE TABLE `t2` (`id` int(32) DEFAULT NULL); Query OK, 0 rows affected (0.042 sec)MySQL [test]> alter table t2 modify column id varchar(32); ERROR 1235 (0A000): Alter non string type not supported暂不支持后面再调整字段顺序,仅新建字段时支持调整顺序。
MySQL [test]> alter table t1 add column `time` date default null; Query OK, 0 rows affected (0.021 sec)MySQL [test]> alter table t1 add column `test_after` varchar(20) after `id`; Query OK, 0 rows affected (0.022 sec)MySQL [test]> alter table t1 modify `test_after` varchar(20) after `time`; ERROR 1235 (0A000): Not supported feature or function
适用版本
OceanBase 数据库 V4.0 以前的所有版本。