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

Cannot drop column referenced by CHECK constraint

    Details

      Description

      If a column check is defined as a separate constraint (not as a part of a column definition), the column cannot be dropped:

      MariaDB [test]> create table t1 (a int, b int, check(a>0));
      Query OK, 0 rows affected (0.63 sec)
       
      MariaDB [test]> show create table t1 \G
      *************************** 1. row ***************************
             Table: t1
      Create Table: CREATE TABLE `t1` (
        `a` int(11) DEFAULT NULL,
        `b` int(11) DEFAULT NULL,
        CONSTRAINT `CONSTRAINT_1` CHECK (a>0)
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1
      1 row in set (0.00 sec)
       
      MariaDB [test]> alter table t1 drop column a;
      ERROR 1054 (42S22): Unknown column 'a' in 'virtual column function'
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: