当前位置:网站首页>PostgreSQL踩坑 | ERROR: operator does not exist: uuid = character varying
PostgreSQL踩坑 | ERROR: operator does not exist: uuid = character varying
2022-07-25 10:20:00 【慌途L】
业务场景:
在MyBatis中对Postgresql数据库的表数据进行update操作,报以下错误:
Caused by: org.postgresql.util.PSQLException: ERROR: column “data” is of type jsonb but expression is of type character varying
建议:You will need to rewrite or cast the expression.
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: uuid = character varying
建议:No operator matches the given name and argument types. You might need to add explicit type casts.
原因:
由于Postgresql数据库的数据类型跟MySQL不一致,导致惯性思维在MyBatis数据库中写sql语句,导致报错。原因其实是同一个,就是接受的参数的数据类型和Postgresql数据库的不一致。
我这里的uuid和data分别是uuid类型和jsonb类型,如下图:
然后MyBatis中的sql如下:
场景就是这样。
解决方法:
在每个类型后面加上对应的类型转换,如uuid类型和jsonb,就在对应的参数后面加上::类型这样的格式即可,如下:
至此,问题解决!
边栏推荐
- JS bidirectional linked list 02
- [domain generalization] 2022 IJCAI domain generalization tutorial Report
- UE4 external open EXE file
- Learn NLP with Transformer (Chapter 3)
- Learn NLP with Transformer (Chapter 7)
- HCIP(13)
- 从开源的视角,解析SAP经典ERP “三十年不用变”的架构设计
- 异步Servlet在转转图片服务的实践
- 【flask高级】结合源码解决flask经典报错:Working outside of application context
- HDD杭州站全程体验有感
猜你喜欢
随机推荐
The most comprehensive UE4 file operation in history, including opening, reading, writing, adding, deleting, modifying and checking
HCIP(13)
信号完整性(SI)电源完整性(PI)学习笔记(三十三)102条使信号完整性问题最小化的通用设计规则
Leetcode 560 prefix and + hash table
DICOM medical image viewing and browsing function based on cornerstone.js
MySQL advanced statement (I) (there is always someone who will make your life no longer bad)
Flask框架——flask-caching缓存
UE4 framework introduction
UE4 external open EXE file
30000 word express Servlet
【域泛化】2022 IJCAI领域泛化教程报告
[servlet] request parsing
基于cornerstone.js的dicom医学影像查看浏览功能
Reinforcement Learning 强化学习(三)
HDD Hangzhou station full experience
HCIP(12)
Learning Weekly - total issue 63 - an open source local code snippet management tool
2021 CEC written examination summary
Flask framework -- flask caching
学习周刊 - 总第 63 期 - 一款开源的本地代码片段管理工具









