I have a spatial data model implemented in PostgreSQL / PostGIS with several alphanumeric and spatial tables. The spatial data is edit mainly through QGIS.
As I want to be able to edit the spatial data in ArcGIS environment and publish a Feature Service in ArcGIS Server, I am trying to implement a solution where I have a column as primary key (PK) managed by PostgreSQL and an OBJECTID column to function as PK in the ArcGIS environment managed by SDE (as solution proposed in: Feature Service from plain PostgreSQL/PostGIS in ArcGIS Server 10.2)
To be able to still edit the spatial data through QGIS I had to implement a trigger function that will fill the OBJECTID (SDE PK) field with the appropriate value. In order to do this, I am using the sde.next_rowid function, but the values returned by this function are different (much higher) than the ones attributed to new features created in ArcGIS environment, as if they were using different sequence numbers.
I know that sde.next_rowid function is using the ids defined in the [table_owner].i[sde_id_from_table_registry], but does anyone have idea where SDE is getting the ids for new features created in ArcGIS environment?
When I run the this SQL statement in PostgreSQL:
SELECT sde.next_rowid('bdsiguser', 'pg_npolicia_pt');
I get a value of 144150.
But, when I edit the same feature class (bdsiguser.pg_npolicia_pt) in ArcGIS and create a new feature, it gets the objectid 143754!
And the next oid values, through each of the methods would be sequencial, i.e., 144151 and 143755 accordingly.
Note: I am using ArcGIS 10.2.2 and PostgreSQL 9.2.2 with PostGIS 2.0.6 (ESRI's recommended PostgreSQL/PostGIS version for this ArcGIS version)