Загрузка данных


CREATE OR REPLACE FUNCTION integration.get_available_applications_api(id text)
 RETURNS text
 LANGUAGE plpgsql
AS $function$

declare 

	row_data jsonb;

	applications text[];

	result_json json;

	v_id int;

begin

	v_id := (id::json->>'id')::int;

	

	return ourpension.f_get_available_applications(v_id, true)::text;


/*	select row_to_json(t)

	into row_data

	from ourpension.f_get_avialable_application(v_id) t;

	

	select array(

		select key

		from jsonb_each_text(row_data)

		where value = 'true' 
		--and key in ('pp', 'rv', 'np_spv')

	)

	into applications;

	

	return array_to_json(applications)::text;*/

end;

$function$