首批通过分布式安全可靠测评,为关键业务系统打造
因新引擎不支持 case column_namewhen 语法导致创建表时报错 -4016,this expr should be rewrote in new engine 的原因和解决方法
更新时间:2026-05-21 01:56
问题现象
在 OceanBase 数据库 V4.x 版本使用 CASE column_name WHEN 建表时报错 -4016,Internal error。
关键日志含有 this expr should be rewrote in new engine(ret=-4016) 信息。
[2024-07-08 11:52:31.581896] WDIAG [SQL.ENG] cg_expr (ob_expr_arg_case.cpp:319) [108471][T1006_L0_G0][T1006][xxxxx-xxxxx-xxxxx-xxxxx] [lt=28][errcode=-4016] this expr should be rewrote in new engine(ret=-4016)
问题原因
新执行引擎仅支持处理 case when xxx then xxx else xxx end,不支持 case 表达式 case xxx when xxx then xxx else xxx end,正常 DML 及查询语句在改写阶段,会将 case xxx when yyy then ... 改为 case when xxx = yyy then ... 而 DDL 语句没有进行改写处理,导致 case xxx when yyy then ... 表达式报错。
问题的风险及影响
出现此问题后会导致此表创建失败。
影响租户
影响 OceanBase 数据库中的 SYS 租户和 Oracle 租户以及 MySQL 租户。
适用版本
OceanBase 数据库 V4.2.1 BP7(oceanbase-4.2.1.7-107000112024052920)及之前版本。
解决方法及规避方式
解决方法:
升级至问题已修复版本。目前已修复的版本包括 OceanBase 数据库 V4.2.1 BP8(oceanbase-4.2.1.8-108000052024072217)及之后版本。
规避方式:
将
case xxx when yyy then ...改为case when xxx = yyy then ...后可以规避成功。