Closed chander closed 4 years ago
Hm, I'm not seeing the problem... I think it may have been a problem with OGR, tossing an error on a missing geometry instead of being chill about it. The FDW naturally stops processing when it is given an ERROR condition. Now that it's not getting that, things work.
ogr_fdw=# select st_extent(geom) from esrijson;
st_extent
---------------------------------------------------------------------------
BOX(-14068917.7610828 3833850.78400869,-12843570.764635 5181374.40356445)
(1 row)
I can, however, replicate the geometry null filter issue
ogr_fdw=# select geom from esrijson where geom is not null;
ERROR: GDAL AppDefined [1] SQL Expression Parsing Error: syntax error, unexpected IS. Occurred around :
( IS NOT NULL)
^
In some cases there appears to be an issue when attempting to query geometry fields on external layers if one or more attributes is missing a geometry.
It would be great if there was an option to set the geoms to null when they were missing - or at least didn't fail the query. I looked in the OGR options for the GeoJSON layer type, but it appears no such OPEN option exists.
TL;DR - computing the extent (
select st_extent(geom) from esrijson
) on the external layerhttps://services.arcgis.com/jDGuO8tYggdCCnUJ/ArcGIS/rest/services/CA_High_Mag_Faults_10_16_13/FeatureServer/0/query?where=1%3D1&outfields=*&f=json
results in the error message in the subject:This appears to be because the service has numerous features without geometry data; you can see that here:
Here's the ogrinfo output from the layer in question - it is publically accessible, so should be easy to reproduce:
Running ogr_fdw_info results in, which creates fine - but returns the error mentioned when an extent is queried:
On a side note, this also has the is not null issue that was remarked on in another ticket (I only mention this because it's easily reproducible here):