Details
Description
create table t1 (c1 int, c2 int, c3 int); |
insert into t1 values (1,2,3),(4,5,6); |
create table t2 like t1; |
insert into t2 values (7,8,9),(10,11,12); |
create view v1 (f1, f2, f3) as select * from ( |
select c1, c2, sum(c3) as s from t1 group by c1, c2 having s > 2 |
union |
select c1, c2, sum(c3) as u from t2 group by c1, c2 having u > 3 ) d2; |
prepare stmt from 'select * from v1 where f2 > 0'; |
execute stmt; |
execute stmt; |
first execution gives the correct answer
+------+------+------+
|
| f1 | f2 | f3 |
|
+------+------+------+
|
| 1 | 2 | 3 |
|
| 4 | 5 | 6 |
|
| 7 | 8 | 9 |
|
| 10 | 11 | 12 |
|
+------+------+------+
|
2nd execution does not
ERROR 1356 (HY000): View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
I have solved this problem in the linked MDEV, but it will be worth backporting the fix to earlier versions.
Attachments
Issue Links
- relates to
-
MDEV-31466 Add optional correlation column list for derived tables
- Closed