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

ALTER TABLE DROP CONSTRAINT not working for unique constraints

    XMLWordPrintable

Details

    Description

      Create a table 'newtable' with a varchar column 'myfield'.

      Add a unique constraint:
      ALTER TABLE newtable ADD CONSTRAINT UNIQUE bla (myfield);

      Drop the constraint again
      ALTER TABLE newtable DROP CONSTRAINT bla RESTRICT;

      You get an error 'You have an error in your SQL syntax'.

      According to the knowledge base, this should work (it's basically copy-pasted):
      https://mariadb.com/kb/en/sql-99/alter-table-statement/#drop-constraint-clause

      Workaround: use DROP INDEX instread of DROP CONSTRAINT
      ALTER IGNORE TABLE newtable DROP INDEX bla;

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              rogierschoutenspirit Rogier Schouten
              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.