I want to dissolve a polygon data set in POSTGIS. So far I've read about some different approaches, e. g. Is there a dissolve function in PostGIS other than st_union? When I run one of the following queries:
SELECT (ST_DUMP(ST_UNARYUNION(ST_COLLECT(geom)))).geom from myTable;
SELECT (ST_DUMP(ST_UNION(geom))).geom from myTable;
most, but not all features are dissolved. Here an example how it looks like before dissolving:

On the left hand side, dissolving was successful, on the right it wasn't.
Does anybody have an idea why this might happen? I want to dissolve all neighboring polygons.
EDIT: The problem becomes awkward. When I Buffer the Polygons before dissolving, the problematic polygons are still not dissolved:

I really can't explain this. The Polygons stem from a ST_DumpAsPolygons operation on a raster..

select st_buffer((st_dump(st_union(st_buffer(geom, 0.0000000001)))).geom, -0.0000000001) from table;Unbuffering must be done After dumping (not after union). Thanks! – David Hanimann Jul 17 '17 at 14:11