Feature Access service: 00166: Layer's ObjectID is not maintained by the database

3086
3
01-02-2014 10:44 AM
JohnZastrow
New Contributor III
Using 10.2 Arcmap/ArcGIS Server on Windows with PostgreSQL 9.2/PostGIS 2.0. I'm try to publish a Feature Access service with all the Operations and Capabilities enabled against a purely PostGIS table (not using Esri's ST_GEOMETRY type). However, when publishing I get this blocking error during the ArcMap validation part.

"00166: Layer's ObjectID is not maintained by the database and the feature service is being published with Create capability enabled"

Here is the database creation script, which clearly has an auto-incrementing primary key (and editing the data outside of ArcMap proves the database is managing the ObjectID values)

CREATE SEQUENCE test_schema.mypoint_const_b_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
 START 1
CACHE 1;
 ALTER TABLE test_schema.mypoint_const_b_seq
 OWNER TO postgres;

CREATE TABLE test_schema.mypoint_const_b
(
  objectid integer NOT NULL DEFAULT nextval('test_schema.mypoint_const_b_seq'::regclass),
  volmon24_i integer,
  site_id integer,
  waterbody character varying(30),
  CONSTRAINT mypoint_const_b_pkey PRIMARY KEY (objectid)
)
WITH (
  OIDS=FALSE
);

SELECT AddGeometryColumn ('test_schema','mypoint_const_b','geom',4326,'MULTIPOINT',2,     false);

ALTER TABLE test_schema.mypoint_const_b
  OWNER TO postgres;

CREATE INDEX mypoint_const_b_geom_gist
  ON test_schema.mypoint_const_b
  USING gist
  (geom);



What are the rules for creating PostGIS tables that ArcGIS Server 10.2 can use for publishing a Feature Access service with the Create function enabled?
Tags (2)
0 Kudos
3 Replies
NidhinKarthikeyan
Occasional Contributor III
0 Kudos
JonathanQuinn
Esri Notable Contributor
Piggybacking off of what Nidhin said, try to use the Add Incrementing ID Field tool within the Toolbox.  This ensures the ObjectID created is consistent with whatever ArcMap/ArcGIS Server requires for that field, in terms of the triggers and sequences.
0 Kudos
JohnZastrow
New Contributor III
Thanks for the reply. I had already seen that link, but in re-reading it I see that it answers one of my questions posted earlier (
http://forums.arcgis.com/threads/98624-Data-type-for-auto-incrementing-OBJECTID-in-Postgres ) which is that Esri does support the Serial data type shortcut for creating incrementing IDs in postgres. I've been running everything as the postgres user so permissions shouldn't be an issue.

But I'm still stumped as to why I'm getting this error (and perhaps relatedly why the tool in this link also fails to work and errors without offering a useful message). I've tried many permutations on the table defs, and I even tried calling the incrementing PK something other than "objectid" and running these tools. I also tried calling it "OBJECTID" only to later read that all caps won't work for Esri.
0 Kudos