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

ALTER TABLE .. ADD PRIMARY KEY IF NOT EXISTS -> ERROR 1068 (42000): Multiple primary key defined

Details

    • 10.0.22

    Description

      MariaDB [test]> CREATE TABLE `market_deductions` (
          ->   `event_id` bigint(20) unsigned NOT NULL DEFAULT '0',
          ->   `market_id` bigint(20) unsigned NOT NULL DEFAULT '0',
          ->   PRIMARY KEY (`event_id`,`market_id`)
          -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
      Query OK, 0 rows affected (0.01 sec)
       
      MariaDB [test]>  ALTER TABLE market_deductions ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id);
      ERROR 1068 (42000): Multiple primary key defined

      Seems IF NOT EXISTS is not really checked.

      Haven't checked if 10.0.22 has fixed this as part of MDEV-8212

      Attachments

        Issue Links

          Activity

            danblack Daniel Black created issue -
            danblack Daniel Black made changes -
            Field Original Value New Value
            Labels alter
            elenst Elena Stepanova made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            elenst Elena Stepanova made changes -
            Fix Version/s 10.1 [ 16100 ]
            Fix Version/s 10.0 [ 16000 ]
            Affects Version/s 10.1 [ 16100 ]
            Affects Version/s 10.0 [ 16000 ]
            Assignee Alexey Botchkov [ holyfoot ]
            Description
            {noformat}
            MariaDB [test]> CREATE TABLE `market_deductions` (
                -> `event_id` bigint(20) unsigned NOT NULL DEFAULT '0',
                -> `market_id` bigint(20) unsigned NOT NULL DEFAULT '0',
                -> PRIMARY KEY (`event_id`,`market_id`)
                -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
            Query OK, 0 rows affected (0.01 sec)

            MariaDB [test]> ALTER TABLE market_deductions ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id);
            ERROR 1068 (42000): Multiple primary key defined
            {noformat}

            Seems IF NOT EXISTS is not really checked.

            Haven't checked if 10.0.22 has fixed this as part of MDEV-8212
            {noformat}
            MariaDB [test]> CREATE TABLE `market_deductions` (
                -> `event_id` bigint(20) unsigned NOT NULL DEFAULT '0',
                -> `market_id` bigint(20) unsigned NOT NULL DEFAULT '0',
                -> PRIMARY KEY (`event_id`,`market_id`)
                -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
            Query OK, 0 rows affected (0.01 sec)

            MariaDB [test]> ALTER TABLE market_deductions ADD PRIMARY KEY IF NOT EXISTS event_id (event_id,market_id);
            ERROR 1068 (42000): Multiple primary key defined
            {noformat}

            Seems IF NOT EXISTS is not really checked.

            Haven't checked if 10.0.22 has fixed this as part of MDEV-8212
            ratzpo Rasmus Johansson (Inactive) made changes -
            Sprint 10.0.22 [ 17 ]
            ratzpo Rasmus Johansson (Inactive) made changes -
            Rank Ranked higher
            holyfoot Alexey Botchkov made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]
            holyfoot Alexey Botchkov made changes -
            Fix Version/s 10.0.22 [ 19700 ]
            Fix Version/s 10.0 [ 16000 ]
            Fix Version/s 10.1 [ 16100 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            elenst Elena Stepanova made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 70132 ] MariaDB v4 [ 149293 ]

            People

              holyfoot Alexey Botchkov
              danblack Daniel Black
              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.