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

Update view have to fail with error ER_VIEW_CHECK_FAILED (1369), but it doesn't

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
    • 10.11
    • None

    Description

      In test below query

      update v1 set c2=3 where c1=1;
      

      have to fail with ER_VIEW_CHECK_FAILED (1369). But if in the first transaction we create and drop another view this query execute with success result.

      Test:

      --source include/have_innodb.inc
       
      create table t1 (old_c1 integer, old_c2 integer,c1 integer, c2 integer, c3 integer) engine=InnoDb;
       
      insert into t1(c1,c2,c3) values (1,1,1);
      insert into t1(c1,c2,c3) values (1,2,2);
      insert into t1(c1,c2,c3) values (1,3,3);
      insert into t1(c1,c2,c3) values (2,1,4);
      insert into t1(c1,c2,c3) values (2,2,5);
      insert into t1(c1,c2,c3) values (2,3,6);
      insert into t1(c1,c2,c3) values (2,4,7);
      insert into t1(c1,c2,c3) values (2,5,8);
       
      commit;
      select * from t1;
       
      start transaction;
      --enable_info ONCE
      update t1 set c1=(select a.c3 from t1 a where a.c3 = t1.c3);
      #select * from t1 ;
      create or replace view v2 as select * from t1 ;
      #select * from v2;
      drop view v2;
      rollback;
       
      delimiter /;
      create or replace trigger trg_t2 after update on t1 for each row
      begin
        declare msg varchar(100);
        if (new.c3 = 5) then
          set msg=concat('in after update trigger on ',new.c3);
          SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg;
        end if;
      end;
      /
      delimiter ;/
       
      create view v1 as select * from t1 where c2=2 with check option;
       
      start transaction;
      -- error 1369
      update v1 set c2=3 where c1=1;
      rollback;
       
      drop view v1;
      drop table t1;
      

      Actual result:

      At line 42: query 'update v1 set c2=3 where c1=1' succeeded - should have failed with errno 1369...
      

      Expected result:
      Test success

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              lstartseva Lena Startseva
              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.