I have a polygon geometry with 100+ polygons originally converted from a raster table - see the below image
Zoomed view of one of the polygons
I would like to unify the touching polygons (i.e. sharing a common vertex or a part of the perimeter). I tried with st_dump(st_union(...)) but it only unifies polygons which share a part of the perimeter and not a vertex. See below
I think I can do this by using st_union and st_touches. But I just don't know how to write the correct SQL with just one geometry as st_tocuhes requires two geometries. My below attempt creates one large multi-polygon with all the polygons which is not what I want
SELECT st_union(a.geom) AS geom
FROM orginal_geom a, original_geom b
WHERE st_touches(a.geom, b.geom)



