Thanks - I'll give that a try.
On Thu, Jul 2, 2009 at 1:17 PM, Suhr, Ralf<
Ralf.Suhr@...> wrote:
> You need two things:
>
> 1) change the geom constraint
>
> ALTER TABLE YOUR_TABLE DROP CONSTRAINT enforce_geotype_geom;
> ALTER TABLE YOUR_TABLE ADD CONSTRAINT enforce_geotype_geom CHECK (geometrytype(geom) = 'POLYGON'::text OR geometrytype(geom) = 'MULTIPOLYGON'::text OR geom IS NULL);
>
> 2) Create a trigger with ST_Multi(NEW.geom) for your table
>
> Be aware, that some functions don't working directly with Multigeometrys.
>
> Ralf
>
> -----Ursprüngliche Nachricht-----
> Von:
postgis-users-bounces@... [mailto:
postgis-users-bounces@...] Im Auftrag von Ben Harper
> Gesendet: Donnerstag, 2. Juli 2009 12:47
> An:
postgis-users@...
> Betreff: [postgis-users] Polygon and Multipolygon distinguished by fieldtype constraint - call for a generic AnyPoly type
>
>
> I am looking for a way of creating a geometry field that has a constrained type identical to the Shapefile spec. Basically, Polygons and MultiPolygons are equals. Linestrings and Multilinestrings are equals. Is there a way to accomplish this with PostGIS? If I make the field Polygon, then I can't insert Multipolygons, and vice versa.
>
> Thanks,
> Ben
> _______________________________________________
> postgis-users mailing list
postgis-users@...
>
http://postgis.refractions.net/mailman/listinfo/postgis-users> _______________________________________________
> postgis-users mailing list
>
postgis-users@...
>
http://postgis.refractions.net/mailman/listinfo/postgis-users>
_______________________________________________
postgis-users mailing list
postgis-users@...
http://postgis.refractions.net/mailman/listinfo/postgis-users