postgresql 运算符不存在
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6342487/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Operator does not exist
提问by gpasse
When trying to create an entity in a Spring-roo PostGres project, I get the following error :
尝试在 Spring-roo PostGres 项目中创建实体时,出现以下错误:
ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: operator does not exist: integer ~~ unknown
Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Position: 433
What could be the solution ?
解决办法是什么?
回答by Denis de Bernardy
Type unknown usually occurs when you've a string literal and Postgres ends up trying to decide if it's a varchar, text, literal array, etc.
当您有一个字符串文字并且 Postgres 最终试图确定它是否是 varchar、文本、文字数组等时,通常会发生类型未知。
Cast your string as needed, e.g.:
根据需要投射您的字符串,例如:
'2'::int
Or don't quote it in the first place, if applicable.
或者不要首先引用它(如果适用)。