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

Denis Rykov rykovd at gmail.com
Wed Sep 1 09:59:42 PDT 2010


It would be great if you can add an exit code for 0 records dbfs,
it'll make my life so much easier.

2010/9/1 Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>:
> 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
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



More information about the postgis-users mailing list