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

DELETE FOR PORTION does not obey "Expression in FOR PORTION OF must be constant" limitation, data can be easily lost

Details

    Description

      create or replace table t1 (a int, s date, e date, period for p(s,e));
      insert into t1 values (1,'2012-01-01','2013-01-01'),(2,'2013-01-01','2014-01-01');
      delete from t1 for portion of p from s to e;
      select * from t1;
       
      # Cleanup
      drop table t1;
      

      10.5 69077dea

      MariaDB [bug]> delete from t1 for portion of p from s to e;
      Query OK, 2 rows affected (0.015 sec)
       
      MariaDB [bug]> select * from t1;
      Empty set (0.001 sec)
      

      UPDATE returns ER_NOT_CONSTANT_EXPRESSION, which is currently documented behavior for both UPDATE and DELETE.

      Attachments

        Activity

          Hi @Nikita Malyavin

          If you are OK, may I pick this issue? I'm interested in contributing MariaDB and seeking a good starting point. The present issue seems to be a good one for a beginner.

          nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - Hi @Nikita Malyavin If you are OK, may I pick this issue? I'm interested in contributing MariaDB and seeking a good starting point. The present issue seems to be a good one for a beginner.

          nayuta-yanagisawa sure, go on! I can't change an assignee because you are not under developer role in jira, but you can just make a pull request and then ping me for a review

          nikitamalyavin Nikita Malyavin added a comment - nayuta-yanagisawa sure, go on! I can't change an assignee because you are not under developer role in jira, but you can just make a pull request and then ping me for a review

          Thanks a lot! I will notify you as soon as I fix the bug.

          nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - Thanks a lot! I will notify you as soon as I fix the bug.

          I've created PR. https://github.com/MariaDB/server/pull/1677

          One of the build tests fails but, I think, it doesn't relate to my change.

          nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - I've created PR. https://github.com/MariaDB/server/pull/1677 One of the build tests fails but, I think, it doesn't relate to my change.
          nikitamalyavin Nikita Malyavin added a comment - - edited

          Fixed by nayuta-yanagisawa, reviewed by me

          nikitamalyavin Nikita Malyavin added a comment - - edited Fixed by nayuta-yanagisawa , reviewed by me

          Thank you for your quick and supportive review!

          nayuta-yanagisawa Nayuta Yanagisawa (Inactive) added a comment - Thank you for your quick and supportive review!

          People

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