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

Support for SEQUENCE objects

    XMLWordPrintable

    Details

      Description

      Add support for SEQUENCES, like in PostgreSQL or Oracle:

      CREATE [ TEMPORARY | TEMP ] SEQUENCE name [ INCREMENT [ BY ] increment ]
          [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ]
          [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ]
      

      See https://www.postgresql.org/docs/8.1/static/sql-createsequence.html
      for details.

      The main part of the task is to add support for sequence tables in the storage engine interface. The main difference between transactional tables are only that they don't roll back when issuing a ROLLBACK statement.

      Example:

      CREATE SEQUENCE s1;
      SELECT s1.NEXTVAL FROM DUAL;
      

      Supported statements:

      • CREATE SEQUENCE
      • DROP SEQUENCE
      • ALTER SEQUENCE
      • NEXT VALUE FOR sequence_name and NEXTVAL(sequence_name)
      • PREVIOUS VALUE FOR sequence_name and LASTVAL(sequence_name)
      • SETVAL(sequence_name, next_value, is_used, round)
      • SHOW CREATE SEQUENCE

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              monty Michael Widenius
              Reporter:
              monty Michael Widenius
              Votes:
              12 Vote for this issue
              Watchers:
              28 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: