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

On duplicate key update makes duplicate records

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Incomplete
    • None
    • N/A
    • None
    • None

    Description

      When executing a query like:

      insert into views (city, country, views) values (1, 1, 1) on duplicate key update views = views + 1;
      

      to the table with primary auto increment key and unique constraint:

      create table views
      (
          id      int unsigned auto_increment primary key,
          city    int unsigned default 0 not null,
          country int unsigned default 0 not null,
          views   int unsigned default 0 not null,
          constraint listing_month unique (city, country)
      )
      

      it sometimes breaks the unique constraint and creates duplicate records on both master and slave.

      Mariadb: Ver 15.1 Distrib 10.10.3-MariaDB, for debian-linux-gnu (x86_64)

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              milivoje Marko
              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.