[Geoserver-devel] [jira] Created: (GEOS-2039) Invalid FID filte results in invalid query, should result in an emtpy feature collection instead

Invalid FID filte results in invalid query, should result in an emtpy feature collection instead
------------------------------------------------------------------------------------------------

                 Key: GEOS-2039
                 URL: http://jira.codehaus.org/browse/GEOS-2039
             Project: GeoServer
          Issue Type: Bug
          Components: WFS
    Affects Versions: 1.7.0-beta1, 1.6.4
            Reporter: Andrea Aime
            Assignee: Andrea Aime
             Fix For: 1.6.5, 1.7.0-beta2

Trying to use a FIDFilter whose structure does not conform to one expected by the FIDMapper in use results in invalid queries, such as:

{code:xml}
<?xml version='1.0' encoding='utf-8' ?>
<wfs:GetFeature xmlns:gml="http://www.opengis.net/gml&quot;
outputFormat="GML2" service="WFS"
xmlns:ogc="http://www.opengis.net/ogc&quot; maxFeatures="1" xmlns=""
xmlns:wfs="http://www.opengis.net/wfs&quot; version="1.0.0"> <wfs:Query
typeName="gisnet3:geonote_point" xmlns:gisnet3="http://gisnet3">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:FeatureId fid="geonote_point.nfm--49e4e129_11b0c9f16f7_-7f5b"></ogc:FeatureId>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
{code:xml}

results in:

{code}
Could not aquire feature:org.geotools.data.DataSourceException: Error
Performing SQL query: SELECT "id", "title", "decription", "type",
"links", "image_links", "video_links",
encode(asBinary(force_2d("the_point"),'XDR'),'base64') FROM
"public"."geonote_point" WHERE () LIMIT 1
Error Performing SQL query: SELECT "id", "title", "decription",
"type", "links", "image_links", "video_links",
encode(asBinary(force_2d("the_point"),'XDR'),'base64') FROM
"public"."geonote_point" WHERE () LIMIT 1
ERREUR: erreur de syntaxe sur ou près de « ) »
{code}

This is a limitation in the sql encoders design. The FIDMapper can throw an exception when going back from the FID to the attribute values, the sql encoder should just remove the featureid from the lot and if the fid filter becomes empty, replace it with a Filter.EXCLUDE instead.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

     [ http://jira.codehaus.org/browse/GEOS-2039?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gabriel Roldán reopened GEOS-2039:
----------------------------------

reopening sine a wrong assumption in JDBCDataStore that filter == preFilter makes the defect still appear for postgis

Invalid FID filter results in invalid query, should result in an emtpy feature collection instead
-------------------------------------------------------------------------------------------------

                Key: GEOS-2039
                URL: http://jira.codehaus.org/browse/GEOS-2039
            Project: GeoServer
         Issue Type: Bug
         Components: WFS
   Affects Versions: 1.6.4, 1.7.0-beta1
           Reporter: Andrea Aime
           Assignee: Gabriel Roldán
            Fix For: 1.7.2

Trying to use a FIDFilter whose structure does not conform to one expected by the FIDMapper in use results in invalid queries, such as:
{code:xml}
<?xml version='1.0' encoding='utf-8' ?>
<wfs:GetFeature xmlns:gml="http://www.opengis.net/gml&quot;
outputFormat="GML2" service="WFS"
xmlns:ogc="http://www.opengis.net/ogc&quot; maxFeatures="1" xmlns=""
xmlns:wfs="http://www.opengis.net/wfs&quot; version="1.0.0"> <wfs:Query
typeName="gisnet3:geonote_point" xmlns:gisnet3="http://gisnet3">
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc&quot;&gt;
<ogc:FeatureId fid="geonote_point.nfm--49e4e129_11b0c9f16f7_-7f5b"></ogc:FeatureId>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>
{code:xml}
results in:
{code}
Could not aquire feature:org.geotools.data.DataSourceException: Error
Performing SQL query: SELECT "id", "title", "decription", "type",
"links", "image_links", "video_links",
encode(asBinary(force_2d("the_point"),'XDR'),'base64') FROM
"public"."geonote_point" WHERE () LIMIT 1
Error Performing SQL query: SELECT "id", "title", "decription",
"type", "links", "image_links", "video_links",
encode(asBinary(force_2d("the_point"),'XDR'),'base64') FROM
"public"."geonote_point" WHERE () LIMIT 1
ERREUR: erreur de syntaxe sur ou près de « ) »
{code}
This is a limitation in the sql encoders design. The FIDMapper can throw an exception when going back from the FID to the attribute values, the sql encoder should just remove the featureid from the lot and if the fid filter becomes empty, replace it with a Filter.EXCLUDE instead.

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira