NEWID Function - SQL Server to PostgreSQL Migration

In SQL Server, the NEWID function generates a UUID value.

In PostgreSQL, you can use the GEN_RANDOM_UUID function.

SQL Server:

  -- Generate a new UUID
  SELECT NEWID();
  /* 68C13548-EC51-4A2F-8CA2-9FCB2D1A8DC2 */

PostgreSQL:

  -- Generate a new UUID
  SELECT GEN_RANDOM_UUID();
  /* a438a056-5be0-42f7-93d6-262a1ff1b103 */

For more information, see SQL Server to PostgreSQL Migration.