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

Update Command not working properly.

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Won't Fix
    • 10.1.13
    • N/A

    Description

      Suppose a table contains data like

          MariaDB [c]> select * from t2;
          +-----+
          | abc |
          +-----+
          |   1 |
          |   3 |
          |   5 |
          +-----+
      

      Suppose my update command is

          MariaDB [c]> update t2 set abc = abc+2;
      

      It give following error

          ERROR 1062 (23000): Duplicate entry '3' for key 'PRIMARY'
      

      I tried the same with oracle database but it worked fine.It seems to me that mariadb is comparing new row with old data ,which is not updated but is going to be update soon.Is it some kind of bug?

      Attachments

        Activity

          It's a documented deficiency. MariaDB updates one row at a time and does not do deferred constraint checking. So, in your example it updates the first row, tries to update abc from 1 to 3, and that immediately fails the uniqueness constraint. The standard correct behavior would've been to update all rows and only then ensure than uniqueness is not violated, but neither MariaDB nor MySQL ever supported that.

          serg Sergei Golubchik added a comment - It's a documented deficiency. MariaDB updates one row at a time and does not do deferred constraint checking. So, in your example it updates the first row, tries to update abc from 1 to 3, and that immediately fails the uniqueness constraint. The standard correct behavior would've been to update all rows and only then ensure than uniqueness is not violated, but neither MariaDB nor MySQL ever supported that.

          Can we correct this deficiency.

          sachin007 sachin setiya (Inactive) added a comment - Can we correct this deficiency.

          Yes, but let's finish your current project first. But feel free to suggest how to fix this issue—you're very welcome to suggest a solution!

          serg Sergei Golubchik added a comment - Yes, but let's finish your current project first. But feel free to suggest how to fix this issue—you're very welcome to suggest a solution!

          People

            serg Sergei Golubchik
            sachin007 sachin setiya (Inactive)
            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.