[QGIS-Developer] OGR: sqlite with subset query, QgsOgrFeatureIterator::fetchFeature with SpatialFilterRect always returns feature with id 0

Sandro Mani manisandro at gmail.com
Sun Sep 3 14:39:19 PDT 2017


On 02.09.2017 23:34, Even Rouault wrote:
>
> >
>
> > Ok makes sense. Though as far as QGIS goes, is there a case where a
>
> > subset query can result in duplicates?
>
> Could happen. The code currently handles the possibility where 
> subsetString() is called with a completely custom SELECT statement, so 
> potentially doing crazy things.
>
Ok, so if we only do this for non-select queries, we should be safe?
>
> >
>
> > Something like this [1] seems to fix the issue, don't know if it's the
>
> > best way forward though?
>
> I've left a few comments in the commit
>
Many thanks. I've pushed a revised version at [1]. I'm in doubt whether 
it is really worth the hassle to hide the orig_ogr_fid column in the 
fields, together with the firstFieldIsFid it looks like it could make 
things very fragile... As far as I can tell, just the modifications in 
[1] without the extra logic should be pretty robust.

[1] 
https://github.com/manisandro/QGIS/commit/82a56eaa5a48a10a1a656657cefd84b619eae3f2

Sandro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170903/66de71f3/attachment.html>


More information about the QGIS-Developer mailing list