 INSERT INTO		model_draft."ego_grid_lv_griddistrictwithoutpop" (geom,load_area_id)
 
 SELECT (ST_DUMP(ST_UNION(cut.geom))).geom::geometry(Polygon,3035), onts.load_area_id
-FROM model_draft."ego_grid_lv_cut" AS cut
+FROM model_draft."ego_grid_lv_griddistrict" AS cut
 	INNER JOIN model_draft."ego_grid_mvlv_substation" AS onts
 ON cut.ont_id = onts.id
 WHERE ont_id >= 0

		FROM
			model_draft."ego_grid_mvlv_substation" AS onts 
			INNER JOIN 
			model_draft."ego_grid_lv_cut" AS regions ON onts.load_area_id = regions.load_area_id
			INNER JOIN 
			model_draft."ego_grid_lv_cut" AS regions2 ON ST_INTERSECTS(regions.geom,regions2.geom)
		WHERE ST_CONTAINS (regions2.geom,onts.geom)
		GROUP BY regions_id


SET geom = ST_UNION(adjacent.geom, districts.geom)
FROM  ( SELECT ST_UNION(cut.geom) AS geom, districts.id AS district_id
	FROM model_draft."ego_grid_lv_griddistrictwithoutpop" AS districts,
		model_draft."ego_grid_lv_griddistrict" AS cut
	WHERE ST_TOUCHES(cut.geom,districts.geom)
	 AND NOT ST_GEOMETRYTYPE (ST_INTERSECTION(cut.geom,districts.geom)) = 'ST_Point'
	 AND cut.id IN (
		SELECT id FROM model_draft."ego_grid_lv_griddistrict" AS cut
		WHERE cut.id NOT IN (
			SELECT cut.id 
			FROM model_draft."ego_grid_lv_griddistrict" AS cut,
				model_draft."ego_grid_lv_griddistrictwithoutpop" AS districts
			WHERE ST_WITHIN(cut.geom,districts.geom)
			GROUP BY cut.id
