PostgreSQL 8.3+为我们带来了许多很棒的新特性。其中包括并行自动真空、枚举、核心搜索,但其中的一个变化是删除了隐式类型转换。
但在PostgreSQL 8.3+中,您可以获得:
select 1::int4 = '1'::text
> ERROR: operator does not exist: integer = text
LINE 1: select 1::int4 = '1'::text
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
原先查询语句需要自行调整
-- PostgreSQL中查看版本的几种方式
show server_version;
/*
SELECT * FROM resume1 WHERE 1 = 1 AND sex LIKE concat ( '%', '0', '%' )
> ERROR: operator does not exist: integer ~~ text
LINE 1: SELECT * FROM resume1 WHERE 1 = 1 AND sex LIKE concat ( '%',...
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
*/
-- 需要修改SELECT * FROM s_user WHERE 1 = 1 AND sex LIKE concat ( '%', '0', '%' ) ;
SELECT * FROM s_user WHERE 1 = 1 AND sex::TEXT LIKE concat ( '%', '0', '%' ) ;
“ERROR: operator does not exist: integer = text” how to fix it?