UPDATE component_set as rc
set env_vars = (

  -- subtract non string properties, resulting object is all keys have values
  select COALESCE((o2.env_vars - od.nonStringProps), '{}'::jsonb) as stringProps
  from component_set as o2 , (

    -- select get an array of all properties whos value is not a string, as an array
    select web_path, array(
      select envK
      from component_set, jsonb_object_keys(env_vars) as envK
      where  jsonb_typeof(component_set.env_vars->envk) <> 'string' and o.web_path = component_set.web_path
    ) as nonStringProps
    from component_set as o
  ) as od

  -- make sure all the web_paths are the same
  where o2.web_path = od.web_path and rc.web_path = o2.web_path
),
headers = (
  -- subtract non string properties resulting object is all keys have values
  select COALESCE((o2.headers - od.nonStringProps), '{}'::jsonb) as stringProps
  from component_set as o2 , (

    -- select get an array of all properties whos value is not a string, as an array
    select web_path, array(
      select headerK
      from component_set, jsonb_object_keys(headers) as headerK
      where  jsonb_typeof(component_set.headers->headerK) <> 'string' and o.web_path = component_set.web_path
    ) as nonStringProps
    from component_set as o
  ) as od

  -- make sure all the web_paths are the same
  where o2.web_path = od.web_path and rc.web_path = o2.web_path
);

-- make columns not nullable
ALTER TABLE component_set ALTER COLUMN env_vars SET NOT NULL;
ALTER TABLE component_set ALTER COLUMN headers SET NOT NULL;

