[postgis-devel] shp2pgsql and shapefiles without vertices

strk at refractions.net strk at refractions.net
Tue Nov 1 01:26:39 PST 2005

On Sat, Oct 29, 2005 at 04:16:23PM +0200, Markus Schaber wrote:
> Hi, Strk,
> strk at refractions.net schrieb:
> > I think we can take that old bug back as a feature.
> > Please file a bug report so I won't forget:
> > http://postgis.refractions.net/bugs
> Maybe we can introduce a command line switch that gives the choice to
> the user:
> -Ni - _i_nsert rows containing null geometries
> -Nd - _d_rop rows containing null geometries
> -Na - _a_bort before loading anything if there are null geometries
> -Ni could be the default for backwards compatibility.

Note that intended behaviour has always been _a_bort if shapefile
contains ONLY null geometries. The check has always been there, but
it contained a bug: return code from SHPReadObject() was checked
for NULL (error condition) rather then for nVertices()==0
(see revision

Rather then drop the check (which require double scan of the
shapefile, and also leaked memory) I just plugged the memory
leak and fixed the bug. 

I've implemented the 3-option switch you suggest in HEAD.
	-N insert, -Ni
	-N skip, -Ns
	-N abort, -Na

As for 1.0 I'd just drop the first scan as a whole, to fix
the back-compatibility issue. Comments ?


More information about the postgis-devel mailing list