文档

Dataphin表中新增decimal字段报错“a table could have either new decimal column or legacy decimal column, but not both”

更新时间:
一键部署

概述

本文主要介绍Dataphin表中新增decimal字段报错“a table could have either new decimal column or legacy decimal column, but not both”的原因。

详细信息

MaxCompute约束表中不可以同时存在decimal新旧两种不同的类型。

通过执行以下SQL区分新旧类型:

desc table_name

执行结果是decimal类型,则为旧类型;

执行结果是decimal(precision, scale)类型,则为新类型。

两者不能同时存在一张表中,decimal(MaxCompute类型1.0,decimal不可指定精度),就不允许同一个表的新增字段类型为decimal(p, s) (MaxCompute类型2.0,decimal不可指定精度)。

由于MaxCompute不支持修改表的字段类型。

  1. 可以重建表将原字段的类型为decimal(p, s)后再新加字段。
  2. 可以将新加字段也用decimal类型。

相关文档

MaxCompute 2.0数据类型

适用于

  • Dataphin

   说明:本文验证基于Dataphin公共云2.9.4-3版本进行验证。

  • 本页导读
文档反馈