-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-5.1This bug affects 5.1.x versions.This bug affects 5.1.x versions.affects-5.2This bug affects 5.2.x versions.This bug affects 5.2.x versions.affects-5.3This bug affects 5.3.x versions.This bug affects 5.3.x versions.affects-5.4This bug affects the 5.4.x(LTS) versions.This bug affects the 5.4.x(LTS) versions.affects-6.0severity/majorsig/sql-infraSIG: SQL InfraSIG: SQL Infratype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
-- set up 2 same tables in different db.
create database if not exists test;
create database if not exists test1;
drop table if exists test.t, test1.t;
drop view if exists test.v;
create table test.t (a int);
insert into test.t values (1);
create table test1.t (a int);
insert into test1.t values (2);
use test;
create view test.v as with tt as (select * from t) select * from tt;
use test;
select * from test.v;
use test1;
select * from test.v;
2. What did you expect to see? (Required)
mysql> use test;
Database changed
mysql> select * from test.v;
+------+
| a |
+------+
| 1 |
+------+
1 row in set (0.01 sec)
mysql> use test1;
Database changed
mysql> select * from test.v;
+------+
| a |
+------+
| 1 |
+------+
1 row in set (0.00 sec)
3. What did you see instead (Required)
mysql> use test;
Database changed
mysql> select * from test.v;
+------+
| a |
+------+
| 1 |
+------+
1 row in set (0.01 sec)
mysql> use test1;
Database changed
mysql> select * from test.v;
ERROR 1356 (HY000): View 'test.v' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
4. What is your TiDB version? (Required)
Metadata
Metadata
Assignees
Labels
affects-5.1This bug affects 5.1.x versions.This bug affects 5.1.x versions.affects-5.2This bug affects 5.2.x versions.This bug affects 5.2.x versions.affects-5.3This bug affects 5.3.x versions.This bug affects 5.3.x versions.affects-5.4This bug affects the 5.4.x(LTS) versions.This bug affects the 5.4.x(LTS) versions.affects-6.0severity/majorsig/sql-infraSIG: SQL InfraSIG: SQL Infratype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.