[GIS] Duplicate ObjectID in ArcSDE Table

arcgis-10.1arcgis-engineenterprise-geodatabasepostgresqlsql

After making a check in from an arcpad AXF file, i notice that there's duplicate ObjectID records.

This ArcSDE PostgreSQL table is versioned and edited by Axf checkins and a .net engine application.

The weird behaviour is that the ObjectIDs from checkin start from the last ObjectID checked in from AXF in the last time, but between these times i added several records using the .net app so the ObjectIDs produced here are duplicated by the last check in, the .net app adds record directly through PostgreSQL, so i set the ObjectID to (Max(ObjectID) + 1).

i'm using ArcSDE 10.1 and PostgreSQL 9.0.8.

i'm not sure but i suppose that the problem comes from generating ObjectID in .net app level.

How could I generate an ObjectID and inform ArcSDE that this ObjectID has been used ?

Best Answer

Here are two possible solutions for your problem:

1) Modify the ArcSDE System tables from your .NET application. The SDE_LAYERS and SDE_TABLE_REGISTRY tables contain rows that represent your table. The row for your table has a MINIMUM_ID field value, which is what the geodatabase will use when it inserts new rows.

I don't recommend making changes to the ArcSDE tables, as they are used by the geodatabase. It is risky.

2) Alter your table's registration with the sdetable command so that the geodatabase does not assign IDs automatically. This is the -C USER option. Then, create a sequence in your database that assigns unique integer IDs to new rows.

I prefer this method as it ensure that a single entity (the database) is now responsible for assigning IDs, and both ArcSDE and your code will need to worry about it.