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

Incorrect error message for "ALTER TABLE ... DROP CONSTRAINT ..., DROP col, DROP col"

    XMLWordPrintable

Details

    Description

      The error message we get for statements of the type "ALTER TABLE ... DROP CONSTRAINT ..., DROP col, DROP col" does not make sense. Example below.

      create table t2(id int primary key);
      create table t1(id int primary key, t2_id int, constraint t1_fk_t2_id foreign key(t2_id) references t2(id));
      

      Then try to drop the constraint and the t2_id column from table t1, but accidentally give two "drop t2_id" clauses.

      alter table t1 drop constraint t1_fk_t2_id, drop t2_id, drop t2_id;
      ERROR 1091 (42000): Can't DROP COLUMN `t1_fk_t2_id`; check that it exists
      

      This not a sensible or correct error message. I would have expected the error message to refer to column t2_id rather than a non-existing column with an identical name to the constraint we're trying to drop.

      I tested this on MariaDB Server 10.8.3 (with a newer mariadb client), but suspect it's present in newer versions as well.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            karll Karl Levik
            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.