ArcGIS Desktop

  • Documentation
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Inserting a value into a global ID or GUID column in PostgreSQL using SQL

Global ID and GUID data types store registry-style strings consisting of 36 characters enclosed in curly brackets. These strings uniquely identify a feature or table row within a geodatabase and across geodatabases. Global IDs are used to maintain uniqueness of records in one-way and two-way geodatabase replicas and nonversioned data used in offline maps. GUIDs can be added to any table.

Iif the table you want to edit participates in replication or offline mapping or contains a GUID, you must insert a unique value to the global ID or GUID column when you insert a new record in the table using SQL. To do this, you can use the sde.Next_GlobalID function.

Note:

You must install the uuid-ossp contrib module to the PostgreSQL database before you can run the Next_GlobalID function.

When editing a nonversioned table that is not enabled for archiving, use the function to insert the ID directly to the table. When editing a nonversioned table that is enabled for archiving, use the function to insert the ID to the archive view of the table. When editing a versioned table, use the function to insert a value to the versioned view of the table.

  1. From psql, log in to the database as a user with privileges to edit the table.

    If you are editing through a versioned or archive view, the user must also have privileges to edit the view.

  2. When inserting a record, use the sde.next_globalid function to insert the next global ID value. Since this is a geodatabase table, it also contains an ObjectID. Use the sde.next_rowid function to insert a value to the ObjectID field as well.
    INSERT INTO jason.assets (objectid, asset_id, globalid) 
     VALUES (
      sde.next_rowid('jason', 'assets'),
      57,
      sde.next_globalid()
     );
    

Related topics

  • Next_GlobalID

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal