-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OGR provider] Revise significantly the way we handle subset filter t…
…o avoid issues with FID (fixes #20136) Some rationale on this change... Previously when applying a "regular" subset string, ie. one that is only the content of a where clause, we issued a full "SELECT * FROM layer WHERE subsetstring", resulting in a OGR SQL layer. The caveat of that is that most OGR drivers will have issues retaining the original FID. A hack consisting in adding a {original_fid_name} as orig_ogc_fid to the select columns was introduced in 4ce2cf1 to try to retain the original FID, but this added a lot of complexity. And actually, in the case of the OGR GPKG driver, it caused it to still be confused when analyzing the column definition of the resulting layer, since it sees 2 FID columns despite the renaming (one included in the '*' wildcard, and the one of orig_ogc_fid), which caused it to use sequential FID numbering (the driver when seeing more than once a column that is the FID column assumes that some cross join is done, and thus that FID are unreliable) A simpler and more robust (crossing fingers!) approach in that case is just to use OGR_L_SetAttributeFilter() instead of GDALDatasetExecuteSQL(). Some care must be taken to cancel the filter when removing the subset filter, or in QgsOgrFeatureIterator when combining with the filter expression coming from the request, but besides that, this is more straightforward, and actually solves #20136
- Loading branch information
Showing
7 changed files
with
147 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.