Mybatis 有空字段数据插入报错

【TDengine 使用环境】
生产环境 /测试/ Poc/预生产环境

【TDengine 版本】
3.6.3 WS驱动(3.6.3)

【操作系统以及版本】
NAME=“CentOS Linux”

VERSION=“7 (Core)”

ID=“centos”

ID_LIKE=“rhel fedora”

VERSION_ID=“7”

PRETTY_NAME=“CentOS Linux 7 (Core)”

ANSI_COLOR=“0;31”

CPE_NAME=“cpe:/o:centos:centos:7”

HOME_URL=“https://www.centos.org/”

BUG_REPORT_URL=“https://bugs.centos.org/”

CENTOS_MANTISBT_PROJECT=“CentOS-7”

CENTOS_MANTISBT_PROJECT_VERSION=“7”

REDHAT_SUPPORT_PRODUCT=“centos”

REDHAT_SUPPORT_PRODUCT_VERSION=“7”
【部署方式】容器/非容器部署
容器

【集群节点数】
单机

【集群副本数】

【描述业务影响】
mybatis plus 插入报错:

Error updating database. Cause: java.sql.SQLException: TDengine ERROR (0x118): (0x118):Invalid parameters

The error may exist in com/lute/iot/device/common/domain/mapper/ThingModelMessageMapper.java (best guess)

The error may involve com.lute.iot.device.common.domain.mapper.ThingModelMessageMapper.insert-Inline

The error occurred while setting parameters

SQL: INSERT INTO thing_model_message ( msg_id, device_id, product_id, tbname, uid, type, ip, code, data, ts ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )

Cause: java.sql.SQLException: TDengine ERROR (0x118): (0x118):Invalid parameters

; uncategorized SQLException; SQL state ; error code [280]; TDengine ERROR (0x118): (0x118):Invalid parameters


有字段为null就会这样,另外希望异常可以抛出来,那个值非法

【问题复现路径/shan】做过哪些操作出现的问题

【遇到的问题:问题现象及影响】

【资源配置】

【报错完整截图】

直接写入超级表的语法,tbname 要在前面:

是不是可以优化一下,用户不用关心这个顺序

嗯 这个后面应该是可以优化的。

你先换成正常的顺序吧


还是一样的

你用超级表写法可以试试这种:INSERT INTO thing_model_message_标签值(msg_id,device_id,product_id,uid,type,ip,code,data,ts) USING thing_model_message TAGS (‘标签值’) VALUES ()
还有一种写法是子表确定存在的情况下可以用:INSERT INTO thing_model_message_标签值(msg_id,device_id,product_id,uid,type,ip,code,data,ts) VALUES ()

把SQL 拿到taos shell看看能否正常使用

拿出来可以执行的

如遇相同问题可另起新帖。

此话题已在最后回复的 30 天后被自动关闭。不再允许新回复。