[postgis-devel] SVN trunk parser modifications stage 2

Kevin Neufeld kneufeld at refractions.net
Sat Oct 18 09:48:12 PDT 2008


Hi Mark,

How many variables are you setting within the function call?  Typically 
in PostgreSQL, setting a variable at runtime for the duration of a 
session or transaction block, the SET command is used.

http://www.postgresql.org/docs/8.3/static/sql-set.html

ie.
SET SESSION client_min_messages TO DEBUG;
SET work_mem TO 131072;
SET LOCAL ENABLE_SEQSCAN TO OFF;


Have you considered using a similiar syntax for these PostGIS variables?
SET SESSION postgis_enable_parser_checks TO OFF;
or
SET postgis_incoming_parser_checks TO ON;
SET postgis_outgoing_parser_checks TO OFF;


I think having the variables is a great idea.  It'll allow users to keep 
the behaviour of the database as it is now, or customize their PostGIS 
install so it behaves more like SDE where only valid geometries are 
allowed in the database. 

I wonder if it'll work to store these variables in postgresql.conf?  
That way the behaviour can be set for a database cluster and all 
sessions as well.

Cheers,
Kevin

Mark Cave-Ayland wrote:
> 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.
>



More information about the postgis-devel mailing list