[postgis-users] [PATCH] Fix pgsql2shp for timestamps

strk strk at keybit.net
Wed Jun 16 06:26:52 PDT 2004


On Wed, Jun 16, 2004 at 01:21:19PM +0300, Steffen Macke wrote:
> Hello All,
> 
> The attached one-line patch fixes the output of
> timestamp fields to shape files.
> Timestamps (e.g. "2004-06-16 08:00:01")  are truncated
> with the current CVS version of pgsql2shp
> 
> It would be nice to see this applied in the CVS
> 
> Steffen

Woudn't the default octet-size computation routine work in this case ?
I think it's ok to add your patch, but we should also fix getMaxFieldSize
if it is not working (it is not even using schema info, BTW).

What value do you get running:
	 SELECT MAX(octet_length(timestamp_field)) FROM table;

--strk;


> --- pgsql2shp.c	13 May 2004 12:24:15 -0000	1.51
> +++ pgsql2shp.c	16 Jun 2004 10:19:41 -0000
> @@ -2584,6 +2584,15 @@
>  		}
>  
>  		/*
> +		 * timestamp field, which we store as a string so we need
> +		 * more width in the column
> +		 */
> +		if(type == 1114)
> +		{
> +			size = 19;
> +		}
> +		
> +		/*
>  		 * For variable-sized fields we'll use max size in table
>  		 * as dbf field size
>  		 */
> 
> 

> _______________________________________________
> 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