operator does not exist: character varying = integer

1.1.前置条件

目标库:V9.0.5.1

源库:MySQL

1.2、问题描述

select
a.id,
cfxx,
cfje,
cfdw,
dwmc
from
sq_qyjbxx a,
jb_xzcfxx b
where a.id = b.id
and a.shjf = ?;

报错:operator does not exist: character varying = integer

1.3、操作步骤

-- 1、查询已有的隐式转换
select
OID,castsource ,(select typname from pg_type where oid = castsource) as castsourcename ,
casttarget , ( select typname from pg_type where oid = casttarget) as casttargetname ,
castfunc , ( select proname from pg_proc where oid = castfunc ) as castfuncname,
castcontext ,
CASE castcontext::text
WHEN 'e'::text THEN '禁止'::text
WHEN 'a'::text THEN '赋值'::text
WHEN 'i'::text THEN '全部'::text
END
from pg_cast where
castsource in( select oid from pg_type
where typname like '%char%' )
and casttarget in( select oid from pg_type
where typname like '%int%' );
-- 2、结果,存在一个仅赋值的隐式转换
19439 1043 varchar 23 int4 19438 varchar_int4 a 赋值
-- 3、修改这个为全部
update pg_cast set castcontext='i' where oid =19439

1.4、预期结果

SQL可以正常执行,查询结果正常

1.5、异常处理

暂未发现相关异常场景

1.6、回滚方案

update pg_cast set castcontext='a' where oid =19439

1.7、典型场景示例

用户在使用源库MySQL时,使用了很多不同类型数据比较、赋值等