[postgis-users] number format weirdness from dbfopen.c?

Stephen Woodbridge woodbri at swoodbridge.com
Sun Jul 3 10:26:59 PDT 2005


gold wrote:
> indeed it does, i think i must have missed that. thanks.
> 
> given that, is it a bug that shp2pgsql doesn't strip the trailing '.', 
> given that it knows it's trying to insert it into an integer column? i 
> don't want to "fix" something before i'm sure it's broken.

Just my opinion, but if it is trying to stuff it into an integer column, 
then the very least it should for is cast it to integer. But given that 
type 'N' columns can be either INT or FLOAT it might be nice to have an 
option to force it to FLOAT maybe something like:
   -F4 cola,colb
the would create "cola" and "colb" as FLOAT4 instead of the default 
INT() type column.

-Steve

> 
> Stephen Woodbridge wrote:
> 
>> gold wrote:
>>
>>> are there any open issues or common experience with some number 
>>> values being read incorrectly from a .dbf file? i noticed this in 
>>> using shp2pgsql, and i'm still trying to track it down.
>>>
>>> basically, shp2pgsql was generating insert statements inserting 
>>> values like '1234.' (notice the trailing '.'). i've put extra 
>>> debugging in my local copy of dbfopen and shp2pgsql, and indeed this 
>>> is the ascii data coming from the .dbf file itself (after the 
>>> whitespace trimming). the fields in question are marked as type 'N', 
>>> as returned by DBFGetNativeFieldType.
>>>
>>> i'm gonna write a separate low level version (bypassing dbfopen) to 
>>> just extract this field and at least get some degree of confirmation 
>>> as to whether this is really how the data is, or whether there's 
>>> something amiss in dbfopen (unlikely, but i should check).
>>>
>>> i'm also going to get in touch with the data providers to see if this 
>>> is something they're aware of. is it possible that in the .dbf world 
>>> '1234.' is valid numeric syntax?
>>
>>
>>
>> Jon,
>>
>> The shapelib API document says DBF type code 'N' (Numeric, with or 
>> without decimal).
>>
>> -Steve W.
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
> _______________________________________________
> 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