mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
25 lines
1.5 KiB
Text
25 lines
1.5 KiB
Text
--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;
|