---
title: 因新引擎不支持 case column_namewhen 语法导致创建表时报错 -4016,this expr should be rewrote in new engine 的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于因新引擎不支持 case column_namewhen 语法导致创建表时报错 -4016,this expr should be rewrote in new engine 的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决因新引擎不支持 case column_namewhen 语法导致创建表时报错 -4016,this expr should be rewrote in new engine 的原因和解决方法的难题。
---
切换语言

- 简体中文
- English

划线反馈

# 因新引擎不支持 case column_namewhen 语法导致创建表时报错 -4016,this expr should be rewrote in new engine 的原因和解决方法

更新时间：2026-05-21 01:56

适用版本： V4.0.x、V4.1.x、V4.2.x 内容类型：Troubleshoot  

## 问题现象

在 OceanBase 数据库 V4.x 版本使用 CASE column_name WHEN 建表时报错 `-4016,Internal error`。

关键日志含有 `this expr should be rewrote in new engine(ret=-4016)` 信息。

```shell
[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 ...` 后可以规避成功。

Previous

[排查 OceanBase 数据库 V4.x 环境中 MySQL 模式下，无主键表生成列做分区键时，表中存在 local unique index 时，存在潜在 core 问题](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000001406986)

Next

[SQL 执行报 ErrorCode = 4016, SQLState = HY000, Details = Internal error](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000262233) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
