[postgis-users] ERROR: new row for relation "x" violates checkconstraint "enforce_geotype_the_geom"
Andreas Laggner
bloediandi at web.de
Thu Aug 9 06:42:30 PDT 2007
Hi Regina,
if i integrate your statement like this:
drop table intersect_gf3;
create table intersect_gf3(gid integer) with oids;
select
addgeometrycolumn('','intersect_gf3','the_geom','31467','MULTIPOLYGON',2);
insert into intersect_gf3
select t1.gid,multi(intersection(t1.the_geom, t2.the_geom))
from gf_clc t1, gf_veg1 t2
where t1.the_geom && t2.the_geom;
i although get the error:
ERROR: new row for relation "intersect_gf3" violates check constraint
"enforce_geotype_the_geom"
SQL Status:23514
hasta luego Andreas
Obe, Regina schrieb:
> In addition to what Frank mentioned. Often times Geomunion applied to polygons or multipolygons may return a Polygon rather than a MultiPolygon.
>
> To force it into a multipolygon type, wrap a multi call around it. Something like
>
> select t1.gid,multi(geomunion(t1.the_geom, t2.the_geom))
> from gf_veg1 t1, gf_veg2 t2;
>
> -----------------------------------
> Also why are you doing a cartesian join?
>
> Hope that helps,
> Regina
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Frank Koormann
> Sent: Thursday, August 09, 2007 6:04 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] ERROR: new row for relation "x" violates checkconstraint "enforce_geotype_the_geom"
>
> Hi again,
>
> * Andreas Laggner <bloediandi at web.de> [070809 11:21]:
>
>> i have to delete this constraint in EVERY table i want to write to! I
>> think that is not normal?!
>>
>
> Partly - yes:
>
> - AddGeometryColumn creates a contraint according to the geometry type
> specified to be compliant with OGC.
> - As a consequence you should first check the potential outcome of your
> geomunion operation before creating the geomcolumn, you might run
> something like:
>
> select distinct(geometrytype(geomunion(t1.the_geom, t2.the_geom)))
> from gf_veg1 t1, gf_veg2 t2
> where t1.the_geom && t2.the_geom;
>
> Regards,
>
> Frank
>
>
More information about the postgis-users
mailing list