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

UPDATE or DELETE FOR PORTION OF increments the value of auto-increment column instead of copying the old one

Details

    Description

      create table t1 (a int auto_increment, b char(16), s date, e date, period for se(s,e), primary key(a,s));
      insert into t1 values (1,'new','2019-01-01','2020-01-01');
      update t1 for portion of se from '2019-07-01' to '2020-07-01' set b = 'updated' where a = 1;
      select * from t1;
      delete from t1 for portion of se from '2019-03-01' to '2019-10-01' where a = 1;
      select * from t1;
       
      drop table t1;
      

      Actual result, 10.4 503fd211

      update t1 for portion of se from '2019-07-01' to '2020-07-01' set b = 'updated' where a = 1;
      select * from t1;
      a	b	s	e
      1	updated	2019-07-01	2020-01-01
      2	new	2019-01-01	2019-07-01
      delete from t1 for portion of se from '2019-03-01' to '2019-10-01' where a = 1;
      select * from t1;
      a	b	s	e
      3	updated	2019-10-01	2020-01-01
      2	new	2019-01-01	2019-07-01
      

      The behavior is not specified in the documentation or (as far as I can tell) in the standard, but it seems obviously wrong, although understandable from the implementation point of view.

      Attachments

        Issue Links

          Activity

            Transition Time In Source Status Execution Times
            Nikita Malyavin made transition -
            Open Closed
            204d 13h 30m 1

            People

              nikitamalyavin Nikita Malyavin
              elenst Elena Stepanova
              Votes:
              1 Vote for this issue
              Watchers:
              5 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.