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

VIEW CHECK OPTION malfunctions with multi UPDATE

    XMLWordPrintable

Details

    • Unexpected results

    Description

        --source include/have_innodb.inc
        CREATE TABLE t1 (id INT, x INT) ENGINE=InnoDB;
        CREATE TABLE t2 (id INT, a INT) ENGINE=InnoDB;
        CREATE TABLE t3 (id INT) ENGINE=InnoDB;
        INSERT INTO t1 VALUES (1,100),(2,200);
        INSERT INTO t2 VALUES (1,1),(2,2),(3,3);
        INSERT INTO t3 VALUES (1),(2);
        CREATE VIEW v AS SELECT t2.* FROM t2 JOIN t3 ON t2.id = t3.id
          WHERE t2.a < 1000 WITH CHECK OPTION;
        --error 0,ER_VIEW_CHECK_FAILED
        UPDATE t1, v SET v.a= v.a + t1.x;
        SELECT * FROM t2;
        --error 0,ER_VIEW_CHECK_FAILED
        UPDATE t1, v SET v.a= 5 ORDER BY t1.x;
        SELECT * FROM t2;
        --error 0,ER_VIEW_CHECK_FAILED
        UPDATE t1, v SET v.a= v.a + t1.x ORDER BY t1.x;
        SELECT * FROM t2;
        DROP VIEW v; DROP TABLE t1, t2, t3;
      

      What happened: none of the three UPDATEs raised an error, and none changed anything. Every SELECT showed (1,1),(2,2),(3,3).

      Expected: rows 1 and 2 of t2 are in the view and stay under 1000 after each update, so they should change:

      • the first UPDATE should give a = 101 and 102 (first t1 row joined is x=100);
      • the SET v.a= 5 one should give 5 and 5.

      Row 3 isn't in the view and should stay 3.

      Attachments

        Activity

          People

            Unassigned Unassigned
            Johnston Rex Johnston
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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