PostgreSQL错误处理“operator does not exist: character varying = bytea at character”
2015-05-29 10:52
2391 查看
PostgreSQL的日志报如下的错误:
2015-05-26 15:34:42.324 CST:(49514):<14753>:[30287041] ERROR: operator does not exist: character varying = bytea at character 704
2015-05-26 15:34:42.324 CST:(49514):<14753>:[30287041] HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
2015-05-26 15:34:42.324 CST:(49514):<14753>:[30287041] STATEMENT: xxx
从给出的报错对应的SQL中可以定位到是哪个=子句,在网络上查找到对应的信息:
当使用hibernate使用参数绑定,而参数的值为null时,hibernate或者PostgreSQL驱动将这个参数映射为varbinary类型,PostgreSQL将varbinary认为为bytea类型
因此,在代码中特殊地处理值为null的情况,避免将null值传送给PostgreSQL即可。
2015-05-26 15:34:42.324 CST:(49514):<14753>:[30287041] ERROR: operator does not exist: character varying = bytea at character 704
2015-05-26 15:34:42.324 CST:(49514):<14753>:[30287041] HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
2015-05-26 15:34:42.324 CST:(49514):<14753>:[30287041] STATEMENT: xxx
从给出的报错对应的SQL中可以定位到是哪个=子句,在网络上查找到对应的信息:
当使用hibernate使用参数绑定,而参数的值为null时,hibernate或者PostgreSQL驱动将这个参数映射为varbinary类型,PostgreSQL将varbinary认为为bytea类型
因此,在代码中特殊地处理值为null的情况,避免将null值传送给PostgreSQL即可。
相关文章推荐
- PostgreSQL新手入门教程
- PostgreSQL教程(十):性能提升技巧
- PostgreSQL教程(二):模式Schema详解
- PostgreSQL教程(十三):数据库管理详解
- PostgreSQL教程(八):索引详解
- PostgreSQL教程(三):表的继承和分区表详解
- 简单介绍Ruby on Rails对PostgreSQL数组类型的支持
- PostgreSQL教程(十九):SQL语言函数
- PostgreSQL教程(四):数据类型详解
- PostgreSql新手必学入门命令小结
- 用一整天的时间安装postgreSQL NTFS权限
- FREEBSD安装POSTGRESQL笔记
- PostgreSQL8.3.3安装方法第1/2页
- 深入理解PostgreSQL的MVCC并发处理方式
- PostgreSQL教程(一):数据表详解
- PostgreSQL教程(十二):角色和权限管理介绍
- PostgreSQL教程(五):函数和操作符详解(1)
- 15个postgresql数据库实用命令分享
- Windows下Postgresql数据库的下载与配置方法