使用管理员账号运行一下方法。
CREATE OR REPLACE FUNCTION boolean_to_smallint(b boolean) RETURNS smallint AS $$ BEGIN RETURN (b::boolean)::bool::int; END; $$LANGUAGE plpgsql; CREATE CAST (boolean AS smallint) WITH FUNCTION boolean_to_smallint(boolean) AS implicit;
添加::text
select to_date(createddate::text,'YYYY-MM-DD') from n_url_test;
主键这样配置,如果有旧数据可能会报主键重复,我是多点几次,让主键++到正确的主键。
方法效果相同的写法:
CAST(#{deptId} AS VARCHAR) = ANY(STRING_TO_ARRAY(ancestors, ','))