[MDEV-29207] Update view have to fail with error ER_VIEW_CHECK_FAILED (1369), but it doesn't Created: 2022-07-29  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.11

Type: Bug Priority: Critical
Reporter: Lena Startseva Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: view-protocol

Issue Links:
PartOf
is part of MDEV-27691 make working view-protocol Open

 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


Generated at Thu Feb 08 10:06:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.