diff --git a/script/sql/postgresql/update.sql b/script/sql/postgresql/update.sql index c7e5af9..854029d 100644 --- a/script/sql/postgresql/update.sql +++ b/script/sql/postgresql/update.sql @@ -53,3 +53,24 @@ insert into sys_menu values('1621', '配置添加', '118', '6', '#', '', '', '1' insert into sys_menu values('1622', '配置编辑', '118', '6', '#', '', '', '1', '0', 'F', '0', '0', 'system:ossConfig:edit', '#', 1, now(), null, null, ''); insert into sys_menu values('1623', '配置删除', '118', '6', '#', '', '', '1', '0', 'F', '0', '0', 'system:ossConfig:remove', '#', 1, now(), null, null, ''); +--postgresql创建于与mysql等效的的find_in_set函数 +CREATE OR REPLACE FUNCTION find_in_set( + value anyelement, + string_list text) + RETURNS integer + LANGUAGE 'plpgsql' + COST 100 + VOLATILE PARALLEL UNSAFE + AS $BODY$ + DECLARE +position INTEGER; +BEGIN + IF string_list = '' THEN + RETURN 0; +ELSE + position := array_position(string_to_array(string_list, ','), value::TEXT); +RETURN position; +END IF; +END; +$BODY$; +