[postgis-users] Size of .dbf file produced with pgsql2shp

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Wed Sep 1 04:03:36 PDT 2010


Denis Rykov wrote:

> Just updated pgsql2shp from svn and try to use it: pgsql2shp -f
> arkhan.shp osm "SELECT st_intersection as geom  from arkhan_line_attr
> WHERE tourism<>''"
> 
> If SELECT returns empty table I get notice:
> ERROR: Could not determine geometry type (empty table).
> Done (postgis major version: 2).
> Output shape: Null Shape
> Dumping: [0 rows].
> 
> At result pgsql2shp produce one .dbf file with 256 Bytes size. Some
> days ago, before updating pgsql2shp, size of such .dbf file was 1
> Byte.
> I use size of this empty *.dbf file in my script. Need I change this
> value to 226 or this is a bug?

Checking the resulting file size is not the right way to be trying to 
detect whether the query returned > 0 rows. It strikes me that the best 
way to detect this would be to return a different exit code from 
pgsql2shp if no rows are returned - would this work for you?


ATB,

Mark.

-- 
Mark Cave-Ayland - Senior Technical Architect
PostgreSQL - PostGIS
Sirius Corporation plc - control through freedom
http://www.siriusit.co.uk
t: +44 870 608 0063

Sirius Labs: http://www.siriusit.co.uk/labs



More information about the postgis-users mailing list