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

CHECK OPTION is ignored for a multi-table update over a view

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 10.1.45, 10.2.32, 10.3.23, 10.4.13, 10.5.3
    • Fix Version/s: 10.2, 10.3, 10.4, 10.5
    • Component/s: Views
    • Labels:
      None

      Description

      For multi-table update statements that update views defined using WITH CHECK OPTION clause the clause may be ignored.
      The problem can be reproduced with the following test case:

      create table t1 (a int) engine=myisam;
      insert into t1 values (0), (3), (1);
      create table t2 (a int) engine=myisam;
      insert into t2 values (1), (0);
      create view v1 as select * from t1 where a < 2 with check option;
      update v1,t2 set v1.a=2 where v1.a=t2.a and t2.a=1;
      select * from t1;
      drop view v1;
      drop table t1,t2;
      

      We can see that the update statements succeeds and v1 is updated ignoring the condition in WHERE a < 2:

      MariaDB [test]> update v1,t2 set v1.a=2 where v1.a=t2.a and t2.a=1;
      Query OK, 1 row affected (0.001 sec)
      Rows matched: 1  Changed: 1  Warnings: 0
       
      MariaDB [test]> select * from t1;
      +------+
      | a    |
      +------+
      |    0 |
      |    3 |
      |    2 |
      +------+
      3 rows in set (0.001 sec)
      

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            igor Igor Babaev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: