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

Error while removing the constraint

    XMLWordPrintable

    Details

      Description

      CREATE TABLE A (
        id bigint NOT NULL AUTO_INCREMENT PRIMARY KEY
      );
       
      CREATE TABLE B (
        what tinyint NOT NULL,
        a bigint NOT NULL,
        CONSTRAINT x FOREIGN KEY (a) REFERENCES A(id),
        CONSTRAINT y CHECK (what > 0)
      );
       
      -- Uncommenting the next line "fixes" an error
      -- INSERT INTO И VALUES (1,1);
       
      SELECT b.a FROM B b;
       
      -- the next statement produces an error
      -- Unknown column '`db_name`.`b`.`what`' in 'CHECK'
      ALTER TABLE B DROP CONSTRAINT x;
      

      online fiddle: https://dbfiddle.uk/?rdbms=mariadb_10.3&rdbms2=mariadb_10.5&fiddle=eefa7abc9c4eab79dcef5e0c79e1e985

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              Akina Владислав Сокол
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration