Opened 13 years ago
Closed 13 years ago
#504 closed enhancement (fixed)
shp2pgsql should rename xmin/xmax fields
|Reported by:||pramsey||Owned by:||pramsey|
There are some column names that cannot be used (oid, xmin, etc) and shp2pgsql should rename input fields to avoid colliding with them automatically (prepend an _ for example).
Change History (4)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
And, for the record, the dumper recognizes the escape character (_) when recreating the shapefile:
comment:3 by , 13 years ago
Exposing the ability to configure the escape character used would also be a valuable thing from my perspective. Not critical at all and potentially not useful to 99% of users, but the basic situation is that I frequently use shp2pgsql to load arbitrary shapefiles into postgis, and then dynamically build django models (in python) from the table schema created by shp2pgsql. A gocha is that the _ is illegal according to django for field names (not sure why), so I have to batch find and rename those fields to remove the leading _.
comment:4 by , 13 years ago
|Status:||new → closed|
xmin escaped as of r5566. xmax was already escaped.
The user-defined escape char might be useful but worth a separate ticket. Note that in order to be symmetric any user-defined escape should be also reflected in the dumper.
We do escape some already (oid included), it's just a matter of adding more. Ref: http://trac.osgeo.org/postgis/browser/trunk/loader/shp2pgsql-core.c#L1185