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

Drop PK issues FK error (poorly), but is still is doing an alter table



    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.1.2
    • 10.4, 10.6
    • None


      Hi everyone,

      I am encountering the following problem:
      I have a database which consists of three tables: users, abonnements, and user_abonnements. users and abonnements have unique IDs and user_abonnements is used to model the relation between users and abonnements (see attachment dump.sql). Until each abonnement should now have a starting date (validFrom) and an end date (validTo), I add two columns using the following queries to the table:

      alter table user_abonnements
          add validFrom date not null;
      alter table user_abonnements
          add validTo date null;

      This works just fine. As a user can also subscribe to the same abonnement multiple times (after the first subscription has ended), I want to add "validFrom" to the primary key such that the columns userID, abonnementID, and validFrom are considered as the primary key. However, when trying to drop the current primary key (userID, abonnementID) of the table, the MariaDB-Server crashes (see docker.log) while executing the following query:

      alter table user_abonnements
          drop primary key;

      I think the server should return an error, stating that the primary key not be dropped because it is used for foreign keys instead of letting the server crash.


        1. dump.sql
          4 kB
        2. docker-compose.yml
          0.3 kB
        3. docker.log
          25 kB

        Issue Links



              nikitamalyavin Nikita Malyavin
              danblack Daniel Black
              0 Vote for this issue
              1 Start watching this issue



                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.