[Geoserver-devel] [JIRA] (GEOS-10187) Custom stored query not working properly

Radoslav Chudý created an issue

GeoServer / BugGEOS-10187

Custom stored query not working properly

Issue Type:

BugBug

Affects Versions:

2.19.0

Assignee:

Unassigned

Created:

10/Aug/21 3:28 PM

Environment:

DEV

Priority:

HighHigh

Reporter:

Radoslav Chudý

I’m trying to find some workaround to fix https://osgeo-org.atlassian.net/browse/GEOS-10171 and I’ve got stucked on another problem. I tried to create my own stored query
<wfs:CreateStoredQuery service=‘WFS’ version=‘2.0.0’
xmlns:wfs=‘http://www.opengis.net/wfs/2.0
xmlns:fes=‘http://www.opengis.net/fes/2.0
xmlns:gml=‘http://www.opengis.net/gml/3.2
xmlns:ad=‘http://inspire.ec.europa.eu/schemas/ad/4.0’>
<wfs:StoredQueryDefinition id=‘addStoredQuery’>
<wfs:Parameter name=‘id’ type=‘string’/>
<wfs:QueryExpressionText
returnFeatureTypes=‘ad:Address’
language=‘urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression’
isPrivate=‘false’>
<wfs:Query typeNames=‘ad:Address’>
<fes:Filter>
<fes:ResourceId rid="$

{id}

"/>
</fes:Filter>
</wfs:Query>
</wfs:QueryExpressionText>
</wfs:StoredQueryDefinition>
</wfs:CreateStoredQuery>

Stored query is created properly but in the response of stored query is 0 features, despite it should return values.
http://46.229.225.194:8081/geoserver/ad/ows?service=WFS&version=2.0.0&request=GetFeature&storedQuery_id=addStoredQuery&id=Address_2056908

I tried to send request to wfs and it it working corectly
<wfs:GetFeature service=“WFS” version=“2.0.0”
xmlns:wfs=“http://www.opengis.net/wfs/2.0” xmlns:fes=“http://www.opengis.net/fes/2.0
xmlns:sf=“http://www.openplans.org/spearfish” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=“http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd”>
<wfs:Query typeNames=“ad:Address”>
<fes:Filter>
<fes:ResourceId rid=“Address_2056908”/>
</fes:Filter>
</wfs:Query>
</wfs:GetFeature>

Here is also log from geoserver>
2021-08-10 15:22:02,024 INFO [geoserver.wfs] -
Request: getFeature
service = WFS
version = 2.0.0
baseUrl = http://46.229.225.194:8081/geoserver/
outputFormat = application/gml+xml; version=3.2
resolve = none
resolveDepth = *
resolveTimeout = 300
resultType = results
abstractQueryExpressionGroup[0] = wfs:abstractQueryExpression=net.opengis.wfs20.impl.StoredQueryTypeImpl@anonymised.com (handle: null) (id: addStoredQuery)
abstractQueryExpression[0]:
parameter[0]:
name = id
value = Address_2056908
id = addStoredQuery
2021-08-10 15:22:02,024 DEBUG [geoserver.complex] - Checking support for request: WFS 2.0.0 GetFeature | operation: Operation( GetFeature, wfs ) | result: org.geoserver.wfs.request.FeatureCollectionResponse$WFS20@anonymised.com6970…
2021-08-10 15:22:02,028 INFO [geoserver.wfs] - Overriding MIME type ‘application/gml+xml; version=3.2’ with ‘application/gml+xml; version=3.2’ for WFS operation ‘GetFeature’.
2021-08-10 15:22:02,029 DEBUG [geotools.xsd] - building schema for schema: http://inspire.ec.europa.eu/schemas/ad/4.0
2021-08-10 15:22:02,040 DEBUG [data.util] - CRSConverterFactory can be applied from Strings to CRS only.
2021-08-10 15:22:02,040 DEBUG [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
2021-08-10 15:22:02,041 TRACE [complex.filter] - fid mapping expression is strConcat([Address_], [id])
2021-08-10 15:22:02,041 TRACE [complex.filter] - Adding unmapped fid filter [ strConcat([Address_], [id]) = ]
2021-08-10 15:22:02,041 DEBUG [complex.filter] - unrolled fid filter is [[ strConcat([Address_], [id]) = ]]
2021-08-10 15:22:02,042 TRACE [util.factory] - ENTRY (FeatureTypeFactory, FEATURE_TYPE_FACTORY)
2021-08-10 15:22:02,042 TRACE [util.factory] - RETURN (FeatureTypeFactory, FEATURE_TYPE_FACTORY): found implementation Optional.
2021-08-10 15:22:02,042 DEBUG [geotools.jdbc] - CREATE CONNECTION
2021-08-10 15:22:02,042 DEBUG [data.jdbc] - exporting SQL ComparisonFilter
2021-08-10 15:22:02,042 DEBUG [data.jdbc] - exporting LiteralExpression
2021-08-10 15:22:02,042 DEBUG [data.jdbc] - exporting PropertyName
2021-08-10 15:22:02,042 DEBUG [data.jdbc] - exporting LiteralExpression
2021-08-10 15:22:02,042 DEBUG [geotools.jdbc] - SELECT “adresy”.“MV_ADDRESS”.“id”,“adresy”.“MV_ADDRESS”.“localid”,“adresy”.“MV_ADDRESS”.“versionid”,“adresy”.“MV_ADDRESS”.“validfrom”,“adresy”.“MV_ADDRESS”.“validto”,“adresy”.“MV_ADDRESS”.“streetname”,“adresy”.“MV_ADDRESS”.“streetnameid”,“adresy”.“MV_ADDRESS”.“propertyregistrationnumber”,“adresy”.“MV_ADDRESS”.“buildingnumber”,“adresy”.“MV_ADDRESS”.“wholenumber”,“adresy”.“MV_ADDRESS”.“municipalityname”,“adresy”.“MV_ADDRESS”.“municipalitycode”,“adresy”.“MV_ADDRESS”.“municipalityid”,“adresy”.“MV_ADDRESS”.“countyname”,“adresy”.“MV_ADDRESS”.“countycode”,“adresy”.“MV_ADDRESS”.“countyid”,“adresy”.“MV_ADDRESS”.“regionname”,“adresy”.“MV_ADDRESS”.“regioncode”,“adresy”.“MV_ADDRESS”.“regionid”,“adresy”.“MV_ADDRESS”.“statename”,“adresy”.“MV_ADDRESS”.“statecode”,“adresy”.“MV_ADDRESS”.“stateid”,“adresy”.“MV_ADDRESS”.“districtname”,“adresy”.“MV_ADDRESS”.“districtcode”,“adresy”.“MV_ADDRESS”.“districtid”,“adresy”.“MV_ADDRESS”.“postalcode”,“adresy”.“MV_ADDRESS”.“postalcodeid”,“adresy”.“MV_ADDRESS”.“axisl”,“adresy”.“MV_ADDRESS”.“axisb”,“adresy”.“MV_ADDRESS”.“buildingindex”,encode(ST_AsEWKB(“adresy”.“MV_ADDRESS”.“geometry”), ‘base64’) as “geometry” FROM “adresy”.“MV_ADDRESS” INNER JOIN (SELECT DISTINCT “adresy”.“MV_ADDRESS”.“id” FROM “adresy”.“MV_ADDRESS” WHERE (‘Address_’ || “id”::text) = ‘’ ORDER BY “adresy”.“MV_ADDRESS”.“id” ASC LIMIT 1000) “MV_ADDRESS_1” ON (“MV_ADDRESS”.“id” = “MV_ADDRESS_1”.“id” ) ORDER BY “adresy”.“MV_ADDRESS”.“id” ASC
2021-08-10 15:22:02,046 TRACE [data.complex] - no more features, produced 0
2021-08-10 15:22:02,046 DEBUG [geotools.jdbc] - CLOSE CONNECTION

From my point of view it looks like, that variable value Address_2056908 is not used in SQL request a it is in the log from getFeature request without stored query

2021-08-10 15:24:37,052 INFO [geoserver.wfs] -
Request: getFeature
service = WFS
version = 2.0.0
baseUrl = http://46.229.225.194:8081/geoserver/
outputFormat = application/gml+xml; version=3.2
resolve = none
resolveDepth = *
resolveTimeout = 300
resultType = results
abstractQueryExpressionGroup[0] = wfs:abstractQueryExpression=net.opengis.wfs20.impl.QueryTypeImpl@anonymised.com (handle: null) (abstractProjectionClause: null, abstractSelectionClause: [ Address_2056908 ], abstractSortingClause: null, aliases: null, typeNames: [

{http://inspire.ec.europa.eu/schemas/ad/4.0}

Address]) (featureVersion: null, srsName: null, filter: null, propertyNames: null, sortBy: null)
abstractQueryExpression[0]:
abstractSelectionClause = [ Address_2056908 ]
typeNames[0] =

{http://inspire.ec.europa.eu/schemas/ad/4.0}

Address
filter = [ Address_2056908 ]
2021-08-10 15:24:37,052 DEBUG [geoserver.complex] - Checking support for request: WFS 2.0.0 GetFeature | operation: Operation( GetFeature, wfs ) | result: org.geoserver.wfs.request.FeatureCollectionResponse$WFS20@anonymised.com…6972…
2021-08-10 15:24:37,054 INFO [geoserver.wfs] - Overriding MIME type ‘application/gml+xml; version=3.2’ with ‘application/gml+xml; version=3.2’ for WFS operation ‘GetFeature’.
2021-08-10 15:24:37,056 DEBUG [geotools.xsd] - building schema for schema: http://inspire.ec.europa.eu/schemas/ad/4.0
2021-08-10 15:24:37,061 DEBUG [data.util] - CRSConverterFactory can be applied from Strings to CRS only.
2021-08-10 15:24:37,061 DEBUG [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
2021-08-10 15:24:37,062 TRACE [complex.filter] - fid mapping expression is strConcat([Address_], [id])
2021-08-10 15:24:37,062 TRACE [complex.filter] - Adding unmapped fid filter [ strConcat([Address_], [id]) = Address_2056908 ]
2021-08-10 15:24:37,062 DEBUG [complex.filter] - unrolled fid filter is [[ strConcat([Address_], [id]) = Address_2056908 ]]
2021-08-10 15:24:37,063 TRACE [util.factory] - ENTRY (FeatureTypeFactory, FEATURE_TYPE_FACTORY)
2021-08-10 15:24:37,063 TRACE [util.factory] - RETURN (FeatureTypeFactory, FEATURE_TYPE_FACTORY): found implementation Optional.
2021-08-10 15:24:37,063 DEBUG [geotools.jdbc] - CREATE CONNECTION
2021-08-10 15:24:37,063 DEBUG [data.jdbc] - exporting SQL ComparisonFilter
2021-08-10 15:24:37,063 DEBUG [data.jdbc] - exporting LiteralExpression
2021-08-10 15:24:37,063 DEBUG [data.jdbc] - exporting PropertyName
2021-08-10 15:24:37,063 DEBUG [data.jdbc] - exporting LiteralExpression
2021-08-10 15:24:37,063 DEBUG [geotools.jdbc] - SELECT “adresy”.“MV_ADDRESS”.“id”,“adresy”.“MV_ADDRESS”.“localid”,“adresy”.“MV_ADDRESS”.“versionid”,“adresy”.“MV_ADDRESS”.“validfrom”,“adresy”.“MV_ADDRESS”.“validto”,“adresy”.“MV_ADDRESS”.“streetname”,“adresy”.“MV_ADDRESS”.“streetnameid”,“adresy”.“MV_ADDRESS”.“propertyregistrationnumber”,“adresy”.“MV_ADDRESS”.“buildingnumber”,“adresy”.“MV_ADDRESS”.“wholenumber”,“adresy”.“MV_ADDRESS”.“municipalityname”,“adresy”.“MV_ADDRESS”.“municipalitycode”,“adresy”.“MV_ADDRESS”.“municipalityid”,“adresy”.“MV_ADDRESS”.“countyname”,“adresy”.“MV_ADDRESS”.“countycode”,“adresy”.“MV_ADDRESS”.“countyid”,“adresy”.“MV_ADDRESS”.“regionname”,“adresy”.“MV_ADDRESS”.“regioncode”,“adresy”.“MV_ADDRESS”.“regionid”,“adresy”.“MV_ADDRESS”.“statename”,“adresy”.“MV_ADDRESS”.“statecode”,“adresy”.“MV_ADDRESS”.“stateid”,“adresy”.“MV_ADDRESS”.“districtname”,“adresy”.“MV_ADDRESS”.“districtcode”,“adresy”.“MV_ADDRESS”.“districtid”,“adresy”.“MV_ADDRESS”.“postalcode”,“adresy”.“MV_ADDRESS”.“postalcodeid”,“adresy”.“MV_ADDRESS”.“axisl”,“adresy”.“MV_ADDRESS”.“axisb”,“adresy”.“MV_ADDRESS”.“buildingindex”,encode(ST_AsEWKB(“adresy”.“MV_ADDRESS”.“geometry”), ‘base64’) as “geometry” FROM “adresy”.“MV_ADDRESS” INNER JOIN (SELECT DISTINCT “adresy”.“MV_ADDRESS”.“id” FROM “adresy”.“MV_ADDRESS” WHERE (‘Address_’ || “id”::text) = ‘Address_2056908’ ORDER BY “adresy”.“MV_ADDRESS”.“id” ASC LIMIT 1000) “MV_ADDRESS_1” ON (“MV_ADDRESS”.“id” = “MV_ADDRESS_1”.“id” ) ORDER BY “adresy”.“MV_ADDRESS”.“id” ASC
2021-08-10 15:24:37,067 DEBUG [data.util] - CRSConverterFactory can be applied from Strings to CRS only.
2021-08-10 15:24:37,067 DEBUG [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
2021-08-10 15:24:37,067 TRACE [complex.filter] - ENTRY FeatureImpl:Address<AddressType id=Address_2056908>= ad:inspireId/base:Identifier/base:localId 2 056 908 null null
2021-08-10 15:24:37,067 DEBUG [data.util] - CRSConverterFactory can be applied from Strings to CRS only.
2021-08-10 15:24:37,067 DEBUG [data.util] - InterpolationConverterFactory can be applied from Strings to Interpolation only.
2021-08-10 15:24:37,067 TRACE [complex.filter] - ENTRY FeatureImpl:Address<AddressType id=Address_2056908>=[ComplexAttributeImpl:inspireId<IdentifierPropertyType>=[ComplexAttributeImpl:Identifier<IdentifierType>=[AttributeImpl:localId<string>=2056908]]] ad:inspireId/base:Identifier/base:namespace https://data.gov.sk/set/rpi/dat/151866/SK_MVSR_INSPIRE_AD null null
2021-08…

Add Comment

Add Comment

Get Jira notifications on your phone! Download the Jira Cloud app for Android or iOS


This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100172-sha1:812d3c4)

Atlassian logo