[postgis-devel] SVN trunk parser modifications stage 2

Obe, Regina robe.dnd at cityofboston.gov
Mon Oct 27 12:35:02 PDT 2008


 

> COPY and INSERT reparse the geometry from EWKB.  If the parser cannot 
> parse degenerate geometries (that is, if ST_GeomFromTextWithStrict()
is 
> the only way to load them), then it won't be possible to reload a 
> degenerate geometry without modifying the dumpfile.  (The situation
may 
> be different with nonstandard  pg_dump --format=c or --format=t, I'm
not 
> sure.)

I don't think Mark was suggesting ST_GeomFromTextWithStrict() would be
the only way to load, in fact I think the idea is that it would be an
optional way to load.

$ psql
db => create table tt as select 1, 'POINT(1 2)'::geometry;
db => insert into tt select 2, 'POINT(3 4)'::geometry;

$ pg_dump -t tt db
...
COPY tt ("?column?", geometry) FROM stdin;
1	0101000000000000000000F03F0000000000000040
2	010100000000000000000008400000000000001040
\.
...

$ pg_dump --inserts -t tt -a db
...
INSERT INTO tt VALUES (1, '0101000000000000000000F03F0000000000000040');
INSERT INTO tt VALUES (2, '010100000000000000000008400000000000001040');
...

Yap that's what I was expecting, but what I was thinking is if the
natural behavior is to not check the validity of the geometry, then you
can load all the invalid geometries to your hearts content :)

So my thinking is that true dump does a 
CAST (::) which is basically I suspect doing a 

ST_GeomFromEWKB if that much, then the default behavior would be to not
validate, but to validate, you would do this:

INSERT INTO tt VALUES(1,
ST_GeomFromEWKB('0101000000000000000000F03F0000000000000040',true));

Of course the config scenario is nicer since it means not changing code
to force strictness based on user preference.




-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.



More information about the postgis-devel mailing list