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

            Cool!!

            I have a question about this, does auto_increment_increment and _offset change anything to sequence behaviour? I guess it could otherwise lead to conflicts in a multi-master cluster.

            michaeldg Michaël de groot added a comment - Cool!! I have a question about this, does auto_increment_increment and _offset change anything to sequence behaviour? I guess it could otherwise lead to conflicts in a multi-master cluster.
            monty Michael Widenius added a comment - - edited

            Yes, auto_increment_increment and _offset will work for sequences defined with INCREMENT=0.
            This is documented at:
            https://mariadb.com/kb/en/mariadb/sequence-overview/#replication

            monty Michael Widenius added a comment - - edited Yes, auto_increment_increment and _offset will work for sequences defined with INCREMENT=0. This is documented at: https://mariadb.com/kb/en/mariadb/sequence-overview/#replication

            About GRANT.

            Sequences uses normal table grants. To read from state of a sequence, one needs SELECT privilege,
            to update the sequence one needs INSERT privilege. To use ALTER SEQUENCE one will need the ALTER privilege.

            monty Michael Widenius added a comment - About GRANT. Sequences uses normal table grants. To read from state of a sequence, one needs SELECT privilege, to update the sequence one needs INSERT privilege. To use ALTER SEQUENCE one will need the ALTER privilege.

            For migrations from Oracle: Access to SEQUENCE objects through migrated SYNONYM constructs should be checked, e.g. through FederatedX and VIEWs.

            abienemann Alexander Bienemann (Inactive) added a comment - For migrations from Oracle: Access to SEQUENCE objects through migrated SYNONYM constructs should be checked, e.g. through FederatedX and VIEWs.

            Pushed into 10.3 tree a long time ago

            monty Michael Widenius added a comment - Pushed into 10.3 tree a long time ago

            People

              monty Michael Widenius
              monty Michael Widenius
              Votes:
              12 Vote for this issue
              Watchers:
              28 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.