postgresql创建于与mysql等效的的find_in_set函数
This commit is contained in:
parent
3693ee1a35
commit
a03742f481
@ -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$;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user