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

Incomplete condition is checked when updating a view defined using WITH CHECK OPTION clause

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • 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

      The following test case demonstrate the problem:

      create table t1 (a int) engine=myisam;
      create table t2 (a int) engine=myisam;
      create table t3 (a int) engine=myisam;
      create table t4 (a int) engine=myisam;
      insert into t1 values (0), (3), (1);
      insert into t2 values (1), (0);
      insert into t3 values (7), (3), (1);
      insert into t4 values (3), (8), (7), (1);
      create view v1 as select t1.a from (t1 join t2 on t1.a>t2.a) join (t3 join t4 on t4.a > t3.a) on t1.a<t4.a with check option;
      update v1 set v1.a=9 where v1.a=1;
      drop view v1;
      drop table t1,t2,t3,t4;
      

      The update statement above succeeds after which we have

      MariaDB [test]> select * from t1;
      +------+
      | a    |
      +------+
      |    0 |
      |    3 |
      |    9 |
      +------+
      

      It means that at least the condition t1.a<t4.a was not checked.
      I debugger we see that the condition that is checked after a row update is actually:

      t1.a > t2.a and t4.a > t3.a
      

        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: