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
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue relates to |
Assignee | Rex Johnston [ JIRAUSER52533 ] |
Description |
{code:sql}
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; {code} first execution give the correct answer {noformat} +------+------+------+ | f1 | f2 | f3 | +------+------+------+ | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | | 10 | 11 | 12 | +------+------+------+ {noformat} 2nd execution does not {noformat} 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 {noformat} I have solved this problem in the linked MDEV, but it will be worth backporting the fix to earlier versions. |
{code:sql}
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; {code} first execution gives the correct answer {noformat} +------+------+------+ | f1 | f2 | f3 | +------+------+------+ | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | | 10 | 11 | 12 | +------+------+------+ {noformat} 2nd execution does not {noformat} 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 {noformat} I have solved this problem in the linked MDEV, but it will be worth backporting the fix to earlier versions. |
Affects Version/s | 11.5.1 [ 29634 ] | |
Affects Version/s | 11.4.2 [ 29633 ] | |
Affects Version/s | 11.2.4 [ 29631 ] | |
Affects Version/s | 11.1.5 [ 29629 ] | |
Affects Version/s | 10.11.8 [ 29630 ] | |
Affects Version/s | 10.6.18 [ 29627 ] | |
Affects Version/s | 11.6.0 [ 29839 ] |
Fix Version/s | 10.11.9 [ 29834 ] | |
Fix Version/s | 11.1.6 [ 29835 ] | |
Fix Version/s | 11.2.5 [ 29836 ] | |
Fix Version/s | 11.4.3 [ 29837 ] | |
Fix Version/s | 11.5.2 [ 29838 ] | |
Fix Version/s | 10.7 [ 24805 ] |
Description |
{code:sql}
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; {code} first execution gives the correct answer {noformat} +------+------+------+ | f1 | f2 | f3 | +------+------+------+ | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | | 10 | 11 | 12 | +------+------+------+ {noformat} 2nd execution does not {noformat} 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 {noformat} I have solved this problem in the linked MDEV, but it will be worth backporting the fix to earlier versions. |
{code:sql}
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; {code} first execution gives the correct answer {noformat} +------+------+------+ | f1 | f2 | f3 | +------+------+------+ | 1 | 2 | 3 | | 4 | 5 | 6 | | 7 | 8 | 9 | | 10 | 11 | 12 | +------+------+------+ {noformat} 2nd execution does not {noformat} 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 {noformat} I have solved this problem in the linked MDEV, but it will be worth backporting the fix to earlier versions. |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Rex Johnston [ JIRAUSER52533 ] | Igor Babaev [ igor ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Fix Version/s | 10.11 [ 27614 ] | |
Fix Version/s | 11.2 [ 28603 ] | |
Fix Version/s | 11.4 [ 29301 ] | |
Fix Version/s | 11.5 [ 29506 ] | |
Fix Version/s | 10.11.9 [ 29834 ] | |
Fix Version/s | 11.1.6 [ 29835 ] | |
Fix Version/s | 11.2.5 [ 29836 ] | |
Fix Version/s | 11.4.3 [ 29837 ] | |
Fix Version/s | 11.5.2 [ 29838 ] |
Assignee | Igor Babaev [ igor ] | Rex Johnston [ JIRAUSER52533 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Needs Feedback [ 10501 ] |
Fix Version/s | N/A [ 14700 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.11 [ 27614 ] | |
Fix Version/s | 11.2 [ 28603 ] | |
Fix Version/s | 11.4 [ 29301 ] | |
Fix Version/s | 11.5 [ 29506 ] | |
Resolution | Incomplete [ 4 ] | |
Status | Needs Feedback [ 10501 ] | Closed [ 6 ] |
Resolution | Incomplete [ 4 ] | |
Status | Closed [ 6 ] | Stalled [ 10000 ] |
Assignee | Rex Johnston [ JIRAUSER52533 ] | Igor Babaev [ igor ] |
Status | Stalled [ 10000 ] | In Review [ 10002 ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Assignee | Igor Babaev [ igor ] | Rex Johnston [ JIRAUSER52533 ] |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.11 [ 27614 ] | |
Fix Version/s | 11.2 [ 28603 ] | |
Fix Version/s | 11.4 [ 29301 ] | |
Fix Version/s | 11.5 [ 29506 ] | |
Fix Version/s | 11.6 [ 29515 ] | |
Fix Version/s | N/A [ 14700 ] |
Fix Version/s | 10.5.26 [ 29832 ] | |
Fix Version/s | 10.6.19 [ 29833 ] | |
Fix Version/s | 10.11.9 [ 29834 ] | |
Fix Version/s | 11.1.6 [ 29835 ] | |
Fix Version/s | 11.2.5 [ 29836 ] | |
Fix Version/s | 11.4.3 [ 29837 ] | |
Fix Version/s | 11.5.2 [ 29838 ] | |
Fix Version/s | 11.6.1 [ 29847 ] | |
Fix Version/s | 10.5 [ 23123 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 10.11 [ 27614 ] | |
Fix Version/s | 11.2 [ 28603 ] | |
Fix Version/s | 11.4 [ 29301 ] | |
Fix Version/s | 11.5 [ 29506 ] | |
Fix Version/s | 11.6 [ 29515 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |