summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/create_drop_server.result
blob: dc3c5eefbf8d8339ff01f6739a1e102d1edbd135 (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
#
# MDEV-7285 SERVER: CREATE OR REPLACE and CREATE IF NOT EXISTS
#
CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user1', HOST 'localhost', DATABASE 'test0');
SELECT server_name, username, db FROM mysql.servers;
server_name	username	db
server1	user1	test0
CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1');
Warnings:
Note	1476	Cannot create foreign server 'server1' as it already exists
SELECT server_name, username, db FROM mysql.servers;
server_name	username	db
server1	user1	test0
CREATE OR REPLACE SERVER server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user3', HOST 'localhost', DATABASE 'test2');
SELECT server_name, username, db FROM mysql.servers;
server_name	username	db
server1	user3	test2
DROP SERVER IF EXISTS server1;
SELECT server_name, username, db FROM mysql.servers;
server_name	username	db
DROP SERVER IF EXISTS server1;
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0');
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1');
ERROR HY000: Cannot create foreign server 'server_1' as it already exists
CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2');
Warnings:
Note	1476	Cannot create foreign server 'server_1' as it already exists
SELECT server_name, username, db FROM mysql.servers;
server_name	username	db
server_1	mysqltest_1	test0
CREATE OR REPLACE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test3');
ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS
CREATE OR REPLACE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test4');
SELECT server_name, username, db FROM mysql.servers;
server_name	username	db
server_1	mysqltest_1	test4
DROP SERVER server_1;
CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'Remote', HOST 'Server.Example.Com', DATABASE 'test');
SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1';
Host
Server.Example.Com
ALTER SERVER server_1 OPTIONS(HOST 'Server.Example.Org');
SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1';
Host
Server.Example.Org
DROP SERVER server_1;