[MDEV-28603] Invalid view when its definition uses TVC as single-value subquery Created: 2022-05-18  Updated: 2023-02-28  Resolved: 2023-02-28

Status: Closed
Project: MariaDB Server
Component/s: Views
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9
Fix Version/s: 10.11.3, 11.0.2, 10.4.29, 10.5.20, 10.6.13, 10.8.8, 10.9.6, 10.10.4

Type: Bug Priority: Critical
Reporter: Lena Startseva Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: view-protocol

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

 Description   

Select from view fails if definition of view has TVC containing subquery used as a subselect.

Test:

create table t1 (a int) engine=myisam;
insert into t1 values (3), (7), (1);
create table t2 (b int) engine=myisam;
insert into t2 values (1), (2);
 
create view v1 as select (values ((select * from t1 where a > 10))) from t2;
select * from v1;
 
drop view v1;
drop table t1,t2;

Actual result:

At line 7: query 'select * from v1' failed: 1356: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

Expected result:

(values ((select * from t1 where a > 10)))
NULL
NULL



 Comments   
Comment by Oleksandr Byelkin [ 2023-02-27 ]

OK to push 841e8877ccb8ef5d692a22b4447383a360557326

Comment by Igor Babaev [ 2023-02-28 ]

A fix for this bug was pushed into 10.4. It should be merged upstream as it is.

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