Updated on 2022-07-29 GMT+08:00

UUID Functions

UUID functions are used to generate UUID data (see UUID Type).

  • uuid_generate_v1()

    Description: Generates a UUID sequence number.

    Return type: UUID

    Example:

    1
    2
    3
    4
    5
    SELECT uuid_generate_v1();
               uuid_generate_v1           
    --------------------------------------
     c71ceaca-a175-11e9-a920-797ff7000001
    (1 row)
    

    The uuid_generate_v1 function generates UUIDs based on the time information, cluster node ID, and thread ID that generates the sequence. Each UUID is globally unique in a cluster, but there is a low probability that a UUID is duplicated among multiple clusters.

  • sys_guid()

    Description: Generate a sequence number that is the same as the sequence number generated by the Oracle sys_guid method.

    Return type: text

    Example:

    1
    2
    3
    4
    5
    SELECT sys_guid();
                 sys_guid             
    ----------------------------------
     4EBD3C74A17A11E9A1BF797FF7000001
    (1 row)
    

    The data generation principle of the sys_guid function is the same as that of the uuid_generate_v1 function.