INSERT INTO public.config_startup
    (config_startup_id, config_template_id, config_service_id,config_environment_id,"version", creator, created_at, updated_at)
SELECT 
    'svn-configure.dev.'|| config_template_id || '.1' as config_startup_id,
    config_template_id,
    'svn-configure' as config_service_id,
    'dev' as config_environment_id,
    1 as "version",
   	creator,
    created_at,
    updated_at
FROM public.config_template 
where config_template_id='postgresql';



INSERT INTO public.config_startup_detail
    (config_startup_detail_id, config_template_detail_id, config_startup_id, config_key, config_value, creator, created_at, updated_at)
SELECT 
    'dev.'|| a.yaml_root_key || '.' || b.config_key  as config_startup_detail_id,
    b.config_template_detail_id,
    'dev.'|| b.config_template_id as config_startup_id,
    b.config_key,
    b.config_value,
    b.creator,
    b.created_at,
    b.updated_at
FROM public.config_template a , public.config_template_detail b 
WHERE a.config_template_id =b.config_template_id and b.config_template_id='postgresql';