[postgis-devel] lwgeom parser robustness and niceness

David Blasby dblasby at refractions.net
Mon Jun 7 10:21:42 PDT 2004


Markus Schaber wrote:

> On Mon, 7 Jun 2004 11:49:53 +0200
> strk <strk at keybit.net> wrote:
> 
> 
>>        -- INVALID geoms
>>        SELECT 'LINESTRING(0 0)'::lwgeom;
>>        SELECT 'POLYGON((0 0, 1 1))'::lwgeom;
>>        SELECT 'POLYGON(0 0)'::lwgeom;
> 
> 
> As I see those, I think it would be good to add a call to isvalid()
> after parsing a lightweight geometry so that only valid geometries can
> be written into the database.

We've had discussion on this before - the consensus was that people 
didnt want this to happen automatically.

If you want your tables to only allow valid geometries, you can add a 
constaint like this:

ALTER TABLE <table> ADD CONSTRAINT <name> CHECK (isvalid(the_geom));

dave




More information about the postgis-devel mailing list