使用antdb数据库,出现“ERROR: operator does not exist: character = integer”提示。

0 sand 1年前 287次点击

求助,使用antdb数据库,出现“ERROR: operator does not exist: character = integer”提示,这该怎么解决啊?

共 1 条评论
JESS 1年前
0 

解决方式

Postgresql8.3以后取消了数据类型隐式转换,因此比较的数据类型需要一致。
AntDB兼容了2种语法模式:默认的postgres和兼容的oracle。
oracle语法模式下,AntDB已经自研兼容了部分数据类型隐式转换的场景,包括该问题的场景已经兼容。
postgres语法模式下,依然会报该错误。
下面给出一个示例说明:

antdb=# \d sy02
Table "public.sy02"
Column | Type | Modifiers
--------+-----------------------+-----------
id | character varying(10) |

antdb=# set grammar TO postgres;
SET
antdb=# select count() from sy02 where id=123;
ERROR: operator does not exist: character varying = integer
LINE 1: select count(
) from sy02 where id=123;
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
antdb=# set grammar TO oracle;
SET
antdb=# select count(*) from sy02 where id=123;
count

 0

(1 row)

原因说明

为了兼容oracle语法,AntDB自研兼容了较大部分的oracle数据类型隐式转换的场景。
建议优先尝试使用oracle语法模式。

添加一条新评论

登录后可以发表评论 去登录