summaryrefslogtreecommitdiffstats
path: root/mysql-test/main/create_drop_server.test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 18:00:34 +0000
commit3f619478f796eddbba6e39502fe941b285dd97b1 (patch)
treee2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/create_drop_server.test
parentInitial commit. (diff)
downloadmariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz
mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/create_drop_server.test')
-rw-r--r--mysql-test/main/create_drop_server.test34
1 files changed, 34 insertions, 0 deletions
diff --git a/mysql-test/main/create_drop_server.test b/mysql-test/main/create_drop_server.test
new file mode 100644
index 00000000..1b9e9b2a
--- /dev/null
+++ b/mysql-test/main/create_drop_server.test
@@ -0,0 +1,34 @@
+--echo #
+--echo # MDEV-7285 SERVER: CREATE OR REPLACE and CREATE IF NOT EXISTS
+--echo #
+
+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;
+CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1');
+SELECT server_name, username, db FROM mysql.servers;
+CREATE OR REPLACE SERVER server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user3', HOST 'localhost', DATABASE 'test2');
+SELECT server_name, username, db FROM mysql.servers;
+DROP SERVER IF EXISTS server1;
+SELECT server_name, username, db FROM mysql.servers;
+DROP SERVER IF EXISTS server1;
+
+
+CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0');
+--error ER_FOREIGN_SERVER_EXISTS
+CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1');
+CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2');
+SELECT server_name, username, db FROM mysql.servers;
+--error ER_WRONG_USAGE
+CREATE OR REPLACE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test3');
+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;
+DROP SERVER server_1;
+
+
+# MDEV-726 convert host names to lowercase
+
+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';
+ALTER SERVER server_1 OPTIONS(HOST 'Server.Example.Org');
+SELECT Host FROM mysql.servers WHERE Server_Name = 'server_1';
+DROP SERVER server_1;