[postgis-users] shp2pgsql: Escaping '\', creategisdb

Steffen Macke sdteffen at web.de
Wed Jun 12 10:02:29 PDT 2002


Dear PostGIS users,

I had a problem loading a shapefile that contained strings
with '\', the character is not escaped by the loader.
Looking at
shp2pgsql.c, line 106:
	if ( (str2 == str) || (str2[-1] != '\\') ) //the previous char isnt a '\'
I wonder wether "'" should be escaped on the shapefile level?
Shouldn't "'" be also escaped if it is following "\"? Of course,
all "\" should be escaped as well. That's what I would like to add once
I'm clear about the special handling of "\'".
Tab escaping for the dump format loader seems to have a similar
problem.
Anything else that has to be escaped?

I think it would be nicel to have a command similar to
'createdb' that creates a new Postgresql db ready for PostGIS use.
This can be established by a simple shell script:
************
#create a Postgresql db and set it up for PostGIS
createdb $1
createlang plpgsql $1
psql -d $1 -f /usr/share/postgresql/contrib/postgis.sql
************
Do you think such a script is useful? I would than try to create a 
creategisdb.in file that is used to create 'creategisdb'  in the make process 
with the updated path to postgis.sql

Steffen






More information about the postgis-users mailing list