[Gdal-dev] ogr2ogr segfaults with large SQL statement

Frank Warmerdam warmerdam at pobox.com
Fri Jan 20 22:14:52 EST 2006


On 1/20/06, Bruce Raup <brauplists at gmail.com> wrote:
> Hello all,
>
>  I am experiencing segmentation faults with ogr2ogr when doing a query on a
> PostGIS database and converting the result to a shapefile.  It happens when
> the query string is very long -- the threshold is somewhere between 2500 and
> 3500 characters, I think.  I looked through the source code but couldn't
> find any statically allocated memory related to that.  Can someone please
> give me a hint on how to fix this in the source?  Or could the limit be
> greatly extended officially?
>
>  I understand that I can use ogr2ogr to *add* records to a shapefile too, so
> I think I can call ogr2ogr multiple times as a work-around.

Bruce,

Could you be more specific about what you are doing?
Are you using ExecuteSQL()?  Or does this happen
doing a "normal" read from a table/layer?  Is the query
long because of alot of fieldnames?  Is there a long
attribute query in effect?

Assuming you are accessing a table normally (rather
than via ExecuteSQL()), I see that the WHERE clause
is assembled into a fixed size 4096 byte buffer in
OGRPGTableLayer::BuildWhere().

I will commit a patch for the limit on the WHERE
clause size.

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




More information about the Gdal-dev mailing list