summaryrefslogtreecommitdiff
path: root/mysql-test/suite/sysschema/r/pr_create_synonym_db.result
blob: 8c0e8dfa9572bc22cfbbd1ba6ef4941dd7abb1b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
CREATE TABLE t1 (t1_id int PRIMARY KEY, t1_val varchar(10));
CREATE TABLE t2 (t2_id int PRIMARY KEY, t1_id int, t2_val int, INDEX (t1_id));
CREATE TABLE `is` (t1_id int PRIMARY KEY, t1_val varchar(10));
CREATE TABLE `ab``c` (t1_id int PRIMARY KEY, t1_val varchar(10));
CREATE SQL SECURITY INVOKER VIEW myview AS SELECT * FROM t1 NATURAL JOIN t2;
CALL sys.create_synonym_db('test', 'test1');
summary
Created 5 views in the `test1` database
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'test1' ORDER BY TABLE_NAME;
TABLE_NAME	SECURITY_TYPE
ab`c	INVOKER
is	INVOKER
myview	INVOKER
t1	INVOKER
t2	INVOKER
CALL sys.create_synonym_db('test', 'test1');
ERROR HY000: Can't create database test1; database exists
CREATE SCHEMA test2;
CALL sys.create_synonym_db('test', 'test2');
ERROR HY000: Can't create database test2; database exists
SELECT COUNT(*) FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'test2';
COUNT(*)
0
CALL sys.create_synonym_db('test', 'is');
summary
Created 5 views in the `is` database
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'is' ORDER BY TABLE_NAME;
TABLE_NAME	SECURITY_TYPE
ab`c	INVOKER
is	INVOKER
myview	INVOKER
t1	INVOKER
t2	INVOKER
CALL sys.create_synonym_db('is', 'i`s');
summary
Created 5 views in the `i``s` database
SELECT TABLE_NAME, SECURITY_TYPE FROM information_schema.VIEWS WHERE TABLE_SCHEMA = 'i`s' ORDER BY TABLE_NAME;
TABLE_NAME	SECURITY_TYPE
ab`c	INVOKER
is	INVOKER
myview	INVOKER
t1	INVOKER
t2	INVOKER
DROP SCHEMA test1;
DROP SCHEMA test2;
DROP SCHEMA `is`;
DROP SCHEMA `i``s`;
DROP VIEW test.myview;
DROP TABLE test.t1;
DROP TABLE test.t2;
DROP TABLE `is`;
DROP TABLE `ab``c`;
#
# MDEV-28342: sys.create_synonym_db fails
#             when a temporary table masks a base table
#
create database db;
use db;
create table a(a int);
create table t (b int);
create table b(a int);
create temporary table b (a int);
call sys.create_synonym_db('db','db_copy');
ERROR HY000: Table`db`.`b`shadows base table. View cannot be created! Terminating!
drop database db;
drop database db_copy;