[postgis-devel] loader incompatibility

Mark Cave-Ayland m.cave-ayland at webbased.co.uk
Fri Apr 1 01:49:36 PST 2005


Hi strk,

> -----Original Message-----
> From: postgis-devel-bounces at postgis.refractions.net 
> [mailto:postgis-devel-bounces at postgis.refractions.net] On 
> Behalf Of strk at refractions.net
> Sent: 01 April 2005 10:26
> To: 'PostGIS Development Discussion'
> Subject: Re: [postgis-devel] loader incompatibility
> 
> 
> On Fri, Apr 01, 2005 at 10:11:16AM +0100, Mark Cave-Ayland wrote:
> > Hi strk,
> > 
> > > -----Original Message-----
> > > From: postgis-devel-bounces at postgis.refractions.net
> > > [mailto:postgis-devel-bounces at postgis.refractions.net] On 
> > > Behalf Of strk at refractions.net
> > > Sent: 01 April 2005 08:59
> > > To: postgis-devel at postgis.refractions.net
> > > Subject: [postgis-devel] loader incompatibility
> > > 
> > > 
> > > Yes, it is again too late for this, but before we
> > > release 1.0.0, should we somehow handle the incompatibilities
> > > between 0.x and 1.x loader ?
> > > 
> > > The new shp2pgsql will produce HEXEWKB queries.
> > > The old shp2pgsql will produce GeometryFromText(EWKT) queries.
> > > 
> > > The old shp2pgsql will work against new postgis.
> > > The new shp2pgsql will NOT work against old postgis.
> > 
> >           ^^^^^^^^^
> > 
> > I guess you meant to type pgsql2shp? ;)
> 
> Nope. I meant shp2pgsql.
> pgsql2shp works on every postgis version as it talks to the 
> database thus it is able to extract postgis version before proceding.

Oops, I totally read that out of context :)

(cut)

> Fair enough. Your opinion lowers my paranoia level ;)

Yeah I'd be inclined to add support if for example we were going from say
1.0.0 to 1.0.1, but for a major bump I think most people would reload data
or dump/restore (I know we will).

> > Looks at the source... I see in pgsql2shp that the main 
> loop declares 
> > a cursor and then does a "FETCH %d FROM cur", where %d is rowbuflen 
> > which defaults to 100. As far as I can see, this FETCH is 
> only called 
> > once and so the resulting shapefile will be truncated to 
> 100 records 
> > maximum - or are my eyes deceiving me?
> 
> Execution of that FETCH query is inside a while(1) loop 
> (264). The loop is explicitly broke by an empty result set. 
> You can trmodify rowbuflen with an environmental variable 
> (undocumented):
> 
> ROWBUFLEN=1000 pgsql2shp db table
> ROWBUFLEN=100 pgsql2shp db table
> ROWBUFLEN=10 pgsql2shp db table
> ROWBUFLEN=1 pgsql2shp db table

Hmmm but as I see it the while() loop cycles through each of the 100 fetched
records and not each *set* of 100 records? I'd expect there to be an outer
loop somewhere with the "FETCH %d FROM cur" inside it, i.e. there should be
another outer while() loop somewhere around line 256....?


Kind regards,

Mark.

------------------------
WebBased Ltd
South West Technology Centre
Tamar Science Park
Plymouth
PL6 8BT 

T: +44 (0)1752 791021
F: +44 (0)1752 791023
W: http://www.webbased.co.uk





More information about the postgis-devel mailing list