ERROR

ERROR: code:400, Unable to complete operation. Unable to perform query operation. Bad syntax in request.

Last Published: May 4, 2023

Error Message

When a dataset in a PostgreSQL database that is not registered with the geodatabase is published to ArcGIS Enterprise, opening the attribute table for the referenced feature layer in ArcGIS Pro and selecting the option to “show selected” records displays the following error message:

Failed to load data.
ERROR: code:400, Unable to complete operation. Unable to perform query operation. Bad syntax in request.
Error returned when opening a table in an unregistered dataset

Cause

When viewing the schema for the dataset, it is determined that the database-maintained, unique, not null column is defined as an identity or unique integer field, as shown in the following image.

Image_2022-08-23_16-13-13.png

Solution or Workaround

For a PostgreSQL database, ArcGIS requires the unique ID field to be of type serial. The error can be resolved in two ways:

  • Use the Add Auto Increment geoprocessing tool to add a database-maintained, incrementing ID field to an existing table or feature class in a PostgreSQL database. A database-maintained ID field is required for all feature classes or tables you plan to edit through a feature service.
  • Define serial as the data type for the unique, not null, database maintained field in the PostgreSQL database. 
SQL to create table with serial id data type

Article ID: 000029875

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options