[Gdal-dev] ogr2ogr segfaults with large SQL statement

Bruce Raup brauplists at gmail.com
Tue Apr 4 15:42:41 EDT 2006


Hello Frank, and all,

This is a continuation of an old thread.  I downloaded the CVS version
of GDAL/OGR yesterday ('gdal-cvs-2006.04.03') to see if your (Frank's)
patch to remove the limit on query length solved our problem with
version 1.6.  It doesn't.

- The old version (I think 1.6, although ogr2ogr -v doesn't show the
version number) can query a view from a PostGIS database, but the CVS
version cannot.

- If the WHERE clause in the SQL statement exceeds around 5000
characters, it still segfaults.

The basic command we're using (sans -where) is:

ogr2ogr -f "ESRI Shapefile" glims_query_12001.shp
                PG:"dbname=glims user=blahblah" glacier_query

where 'glacier_query' is the name of a view, which includes a geometry column.

                This command works with version 1.6.

                This command does not work with the CVS version (on any view or
                any table without a geom column).

I'm hoping the problem is just that we're using the wrong syntax.  The
user documentation is kinda thin related to this type of query.

Thanks in advance for your response,
Bruce Raup


On 1/26/06, Frank Warmerdam <warmerdam at pobox.com> wrote:
> On 1/25/06, Bruce Raup <brauplists at gmail.com> wrote:
> >  So, the work-around was to use MapServer to identify the entities we want
> > by ID, then hand a (potentially huge) list of IDs to ogr2ogr.  It seems
> > obvious to me that we're running into the 4096 byte limit.  Where is
> > OGRPGTableLayer::BuildWhere() defined?  I did
> >
> >  cd gdal-1.2.5/ogr
> >  grep 'OGRPGTableLayer::BuildWhere' *.h *.cpp
> >
> >  but found nothing.  Any other ideas on how to get around this problem?
>
> Bruce,
>
> It is in gdal/ogr/ogrsf_frmts/pg/ogrpgtablelayer.cpp.
>
> If you are building GDAL/OGR yourself locally, you can
> grab all the files from the website to replace your existing
> PG driver, or upgrade to a full nightly CVS build.
>
>   http://www.gdal.org/srctree/ogr/ogrsf_frmts/pg/
>
> Best regards,
> --
> ---------------------------------------+--------------------------------------
> I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
> light and sound - activate the windows | http://pobox.com/~warmerdam
> and watch the world go round - Rush    | Geospatial Programmer for Rent
>


--
Bruce Raup
http://cires.colorado.edu/~braup/




More information about the Gdal-dev mailing list