[postgis-devel] Attributes size (was: shp2pgsql -> pgsql2shp problem)

Paul Ramsey pramsey at refractions.net
Mon Oct 3 09:18:10 PDT 2005


I think this is entirely safe.  DBF reading requires the header, if  
the header is malformed relative to the data, then things will be  
fubar anyways, and there is nothing the reader can do about it.  So  
there will not be any unexpected truncations or anything as a result  
of this patch.

P

On Oct 3, 2005, at 6:09 AM, strk at refractions.net wrote:

> On Mon, Oct 03, 2005 at 07:13:05AM -0400, Stephen Woodbridge wrote:
>
>> strk at refractions.net wrote:
>>
>>> Stephen, no way to specify dbf attribute sizes currently.
>>> Integer columns are output with a length of 16.
>>> Floating values with a length of 32.
>>>
>>
>> OK, I can probably live with the Integer and Floating column changes,
>> but the character column width are also changing. When I load and
>> extract a shapefile the character columns widths change and they  
>> seem to
>> change a different amount for each file loaded and extracted. I am
>> assuming that there is a query to fine the max width of the data  
>> and to
>> set the width of the column to the max. This is great if it is an
>> option, but if you try to extract a province worth of data for each
>> province then the column width varies with each file and you can  
>> not use
>> the data in a mapserver tileindex.
>>
>
> You're assumption is right, max width is extracted from actual values.
>
> The attached patch makes pgsql2shp use the length limits set to char
> and varchar attributes, if any. And shp2pgsql set length limits for
> dbf attributes of type STRING.
>
> Before committing, I'd like to gather some feedback as there might
> be cases of failures due to malformed shapefiles. These cases
> might be handled by using the -p (prepare) switch and manually
> editing the receiving table structure or adding yet another switch
> to avoid setting limits on STRING attributes.
>
> Comments welcome.
> The patch applies to current CVS (head branch).
>
> --strk;
>
> <loaderdumper.patch>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>




More information about the postgis-devel mailing list