| 1 |
CREATE TABLE t1 (t1_id int PRIMARY KEY, t1_val varchar(10)); |
| 2 |
CREATE TABLE t2 (t2_id int PRIMARY KEY, t1_id int, t2_val int, INDEX (t1_id)); |
| 3 |
CREATE TABLE `is` (t1_id int PRIMARY KEY, t1_val varchar(10)); |
| 4 |
CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10)); |
| 5 |
CREATE SQL SECURITY INVOKER VIEW myview AS SELECT * FROM t1 NATURAL JOIN t2; |
| 6 |
CALL sys.create_synonym_db('test', 'test1'); |
| 7 |
summary |
| 8 |
Created 5 views in the `test1` database |
| 9 |
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'test1' ORDER BY TABLE_NAME; |
| 10 |
TABLE_NAME SECURITY_TYPE |
| 11 |
ab`c INVOKER |
| 12 |
is INVOKER |
| 13 |
myview INVOKER |
| 14 |
t1 INVOKER |
| 15 |
t2 INVOKER |
| 16 |
CALL sys.create_synonym_db('test', 'test1'); |
| 17 |
ERROR HY000: Can't create database test1; database exists |
| 18 |
CREATE SCHEMA test2; |
| 19 |
CALL sys.create_synonym_db('test', 'test2'); |
| 20 |
ERROR HY000: Can't create database test2; database exists |
| 21 |
SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'test2'; |
| 22 |
COUNT(*) |
| 23 |
0 |
| 24 |
CALL sys.create_synonym_db('test', 'is'); |
| 25 |
summary |
| 26 |
Created 5 views in the `is` database |
| 27 |
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'is' ORDER BY TABLE_NAME; |
| 28 |
TABLE_NAME SECURITY_TYPE |
| 29 |
ab`c INVOKER |
| 30 |
is INVOKER |
| 31 |
myview INVOKER |
| 32 |
t1 INVOKER |
| 33 |
t2 INVOKER |
| 34 |
CALL sys.create_synonym_db('is', 'i`s'); |
| 35 |
summary |
| 36 |
Created 5 views in the `i``s` database |
| 37 |
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'i`s' ORDER BY TABLE_NAME; |
| 38 |
TABLE_NAME SECURITY_TYPE |
| 39 |
ab`c INVOKER |
| 40 |
is INVOKER |
| 41 |
myview INVOKER |
| 42 |
t1 INVOKER |
| 43 |
t2 INVOKER |
| 44 |
DROP SCHEMA test1; |
| 45 |
DROP SCHEMA test2; |
| 46 |
DROP SCHEMA `is`; |
| 47 |
DROP SCHEMA `i``s`; |
| 48 |
DROP VIEW test.myview; |
| 49 |
DROP TABLE test.t1; |
| 50 |
DROP TABLE test.t2; |
| 51 |
DROP TABLE `is`; |
| 52 |
DROP TABLE `ab``c`; |
| 53 |
# |
| 54 |
# MDEV-28342: sys.create_synonym_db fails |
| 55 |
# when a temporary table masks a base table |
| 56 |
# |
| 57 |
create database db; |
| 58 |
use db; |
| 59 |
create table a(a int); |
| 60 |
create table t (b int); |
| 61 |
create table b(a int); |
| 62 |
create temporary table b (a int); |
| 63 |
call sys.create_synonym_db('db','db_copy'); |
| 64 |
summary |
| 65 |
Created 2 views in the `db_copy` database |
| 66 |
use db_copy; |
| 67 |
show tables; |
| 68 |
Tables_in_db_copy |
| 69 |
a |
| 70 |
t |
| 71 |
drop database db; |
| 72 |
drop database db_copy; |
| 73 |
# MDEV-28343: sys.create_synonym_db fails with ER_VIEW_SELECT_TMPTABLE |
| 74 |
# when schema contains temporary tables |
| 75 |
# |
| 76 |
create database mytestdb; |
| 77 |
use mytestdb; |
| 78 |
create table t (b int); |
| 79 |
create temporary table tmp (a int); |
| 80 |
call sys.create_synonym_db('mytestdb','db_syn1'); |
| 81 |
summary |
| 82 |
Created 1 view in the `db_syn1` database |
| 83 |
use db_syn1; |
| 84 |
show tables; |
| 85 |
Tables_in_db_syn1 |
| 86 |
t |
| 87 |
drop database db_syn1; |
| 88 |
use mytestdb; |
| 89 |
create temporary table t (b int); |
| 90 |
call sys.create_synonym_db('mytestdb','db_syn1'); |
| 91 |
summary |
| 92 |
Created 0 views in the `db_syn1` database |
| 93 |
use db_syn1; |
| 94 |
show tables; |
| 95 |
Tables_in_db_syn1 |
| 96 |
drop database mytestdb; |
| 97 |
drop database db_syn1; |