INSERT INTO VCLib.T_BASE_FEATURE_SETTINGS
           (BaseFeatureSettingsID
           ,ClientModuleFeature
           ,RoleClientModules
           ,type_)
SELECT
           gen_random_uuid()--<BaseFeatureSettingsID, uniqueidentifier,>
          ,(select f.ClientModuleFeatureID from VCLib.T_CLIENT_MODULE_FEATURE f where f."name" = 'CopyAllSelectedObjects' limit 1)--<ClientModuleFeature, uniqueidentifier,>
          ,rcm.RoleClientModuleID--<RoleClientModules, uniqueidentifier,>
          ,(select e.EntityID from VCLib.T_ENTITIES e where e.EntName = 'BASE_FEATURE_SETTINGS' and e."schema" = 'VCLib' limit 1)--<type_, int,>)
from VCLib.T_ROLE_CLIENT_MODULES rcm
    join VCLib.T_CLIENT_MODULES cm on cm.ClientModuleID = rcm.ClientModuleID
where cm.ModuleType = 'UserClientModule'
        and
    not exists
    (
        select *
        from VCLib.T_BASE_FEATURE_SETTINGS bfs
            join VCLib.T_CLIENT_MODULE_FEATURE cmf on cmf.ClientModuleFeatureID = bfs.ClientModuleFeature
        where bfs.RoleClientModules = rcm.RoleClientModuleID
                and
            cmf."name" = 'CopyAllSelectedObjects'
    );
