Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24285

support oracle build-in function: sys_guid

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.6.1
    • Server
    • None

    Description

      SYS_GUID is an Oracle function, similar to the UUID function in mariadb, the document link is:
      https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/SYS_GUID.html#GUID-761E36B4-32DA-497D-8829-3D4653381F9B

      there are two difference between sys_guid and uuid in mariadb :

      • output format: the output of sys_guid without '-' character.
      • use different algorithms,please note the red font in the example
        1. Execute sys_guid multiple times in a session, and add 1 to the 12th byte of output each time
        2. execute sys_guid in different sessions, the 6~16 bytes and last 4 bytes of output are different

      example for oracle sys_guid

      SQL> SELECT SYS_GUID() FROM DUAL;

      SYS_GUID()
      --------------------------------
      B4F9C877B1264B49E05315500A0A222B

      SQL> SELECT SYS_GUID() FROM DUAL;

      SYS_GUID()
      --------------------------------
      B4F9C877B1274B49E05315500A0A222B

      SQL> SELECT SYS_GUID() FROM DUAL;

      SYS_GUID()
      --------------------------------
      B4F9C877B1284B49E05315500A0A222B

      • start new session and execute sys_guid

      SQL> SELECT SYS_GUID() FROM DUAL;

      SYS_GUID()
      --------------------------------
      B4F9CCEB9C1A4CBDE05315500A0AA3C2

      SQL> SELECT SYS_GUID() FROM DUAL;

      SYS_GUID()
      --------------------------------
      B4F9CCEB9C1B4CBDE05315500A0AA3C2

      SQL> SELECT SYS_GUID() FROM DUAL;

      SYS_GUID()
      --------------------------------
      B4F9CCEB9C1C4CBDE05315500A0AA3C2

      I have implemented SYS_ GUID, the behavior and algorithms are the same as UUID, but the output format is different.

      MariaDB [(none)]> select sys_guid();
      +----------------------------------+
      | sys_guid()                       |
      +----------------------------------+
      | 4FE31C7B2F8E11EB8DAAA87EEAED1F75 |
      +----------------------------------+
      1 row in set (0.000 sec)
       
      MariaDB [(none)]> select sys_guid();
      +----------------------------------+
      | sys_guid()                       |
      +----------------------------------+
      | 50DEAB622F8E11EB8DAAA87EEAED1F75 |
      +----------------------------------+
      

      Attachments

        Issue Links

          Activity

            People

              monty Michael Widenius
              woqutech woqutech
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.