laptop and a wrench

Bug

When Return Distinct Values is set to True for a feature service or map service and a geometry type is specified, a query from ArcGIS REST API fails on ArcGIS Server with PostgreSQL as the underlying database.

Last Published: July 5, 2019 ArcGIS GIS Server
Bug ID Number BUG-000118572
SubmittedDecember 4, 2018
Last ModifiedJune 5, 2024
Applies toArcGIS GIS Server
Version found10.6.1
Operating SystemWindows OS
Operating System Version2016 64 Bit
StatusKnown Limit

Additional Information

This is a known limitation in ArcGIS Server. Our ArcGIS Server REST API states the following: Note: Make sure to set returnGeometry = false when returnDistinctValues = true or results will not be reliable. https://developers.arcgis.com/rest/services-reference/query-feature-service-layer-.htm

Workaround

  1. Run a query with only Return IDs Only set to True, along with an Input Geometry specified.
  2. Take note of the ObjectIDs that are returned and then run another query.
  3. Place the returned ObjectIDs into a second query with the following parameters:
    1. Remove the input geometry.
    2. Return Distinct Values = True.
    3. Return IDs Only = False.
  4. The query should complete successfully.

Steps to Reproduce

Bug ID: BUG-000118572

Software:

  • ArcGIS GIS Server

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options