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

Impossible to drop primary key in certain circumstances

    XMLWordPrintable

    Details

      Description

      Dropping primary key in some cases fails because of foreign constraints on the table of the primary key, which makes no sense.

      Test case:

      create table test_a (id int primary key);
      create table test_b (id int primary key);
      create table test_a_b (a int not null,
                             b int not null,
                             constraint ref_a foreign key (a) references test_a (id),
                             constraint ref_b foreign key (b) references test_b (id));
      alter table test_a_b add constraint a_b_pk primary key (a, b);
      alter table test_a_b drop primary key;
      

      Note that the first four statements succeed, which means that both states without and with primary key on `test_a_b` are consistent. However, the last statement fails. In other words, the database doesn't let me to go from one consistent state to another.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sanja Oleksandr Byelkin
              Reporter:
              doublep Paul Pogonyshev
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated: