[postgis-devel] SVN trunk parser modifications stage 2

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Sat Oct 18 00:55:47 PDT 2008


Hi everyone,

Now that the new parser API is in place, I'd like to discuss how we can 
control its behaviour from within PostGIS/PostgreSQL. Normally the 
parser is very strict in terms of validating input geometries, however 
there have been a few documented cases where it is necessary to load 
invalid data into the database in order for it to be cleaned up.

I would like to propose that the parser behaviour can be toggled using a 
set of in-built stored procedures similar to below:


The documented API:

SELECT postgis_disable_parser_checks()
	- This will disable ALL checks performed by the parser for the
	remaining duration of the connection. This will throw a very
	large WARNING to let you know that what you are doing can will
	potentially allow bad data into the database and that its
	effects only last for the duration of the session.

SELECT postgis_enable_parser_checks()
	- This will re-enable ALL checks performed by the parser. Note
	that all checks enabled will remain the default.


The undocumented API:

SELECT postgis_parser_checks(int, int)
	- This will allow advanced developers the ability to specify the
	parser checks as 2 bitmaps: 1 for incoming geometries, and 1 for
	outgoing geometries (those generated by GEOS). It is designed
	for use and testing by developers only.


Note that I have deliberately named these functions so that they are in 
the postgis_ namespace rather than the ST_ namespace, and so developers 
should be well aware that what they are doing is definitely outside of 
the OGC specification and that its behaviour is unique to PostGIS.

Once these changes have been committed, the final stage of the plan is 
to move shp2pgsql/pgsql2shp over to use liblwgeom and the new stored 
procedures (adding something like a --force option to trigger this 
behaviour).


Thoughts?

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-devel mailing list