[postgis-users] problems with UPDATE

Daniel Grum daniel.grum at unibw.de
Fri Dec 4 04:39:59 PST 2009


Hi

I want to update a geometry table with polygon geometries:

UPDATE wald_by
SET the_geom = 
ST_BuildArea(ST_Collect(ST_Intersection(poly.the_geom,ST_Expand(pt.the_geom, 
2000)),poly.the_geom))
FROM public.wald_by poly, public.holzfaeller pt, public.runden i
WHERE poly.the_geom && ST_Expand(pt.the_geom, 2000) AND pt.style=2 AND 
i%10=0;

Every 10th round this Update will be startet and only for this that have 
the style=2 -->lumberjacks that clear wood and not work regenerative 
like style=1.

Info to the attributes of the table:
 gid serial NOT NULL,  id integer,  the_geom geometry,  flaeche double 
precision,  flaeche_ges double precision,
  CONSTRAINT wald_by_pkey PRIMARY KEY (gid),
  CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) = 
'MULTIPOLYGON'::text OR the_geom IS NULL),
  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 31467)

The Update don't works because:
ERROR:  new line for relation »wald_by« breaches Check-Constraint 
»enforce_geotype_the_geom«

So I thing the new geometry is no MULTIPOLYGON???!!!

Are there any ideas?

--daniel



More information about the postgis-users mailing list